File tree Expand file tree Collapse file tree 1 file changed +8
-1
lines changed
client/src/components/donations Expand file tree Collapse file tree 1 file changed +8
-1
lines changed Original file line number Diff line number Diff line change @@ -425,11 +425,18 @@ export const Donations = () => {
425425 backend . get ( `/lastUpdated/donations` ) ,
426426 backend . get ( `/donations/donors` )
427427 ] ) ;
428+
429+ if ( ! donationsResponse . data [ 0 ] . id ) {
430+ donationsResponse . data = donationsResponse . data . map ( ( donation : any , index : number ) => ( {
431+ ...donation ,
432+ id : index + 1
433+ } ) ) ;
434+ }
428435 setValueSum ( valuesResponse . data [ 0 ] ?. sum || 0 ) ;
429436 setWeightSum ( weightResponse . data [ 0 ] ?. sum || 0 ) ;
430437 setAllDonations ( donationsResponse . data ) ;
431438 setDonors ( donorResponse . data . map ( ( donor : { name : string } ) => donor . name ) ) ;
432-
439+
433440 const date = new Date ( lastUpdatedResponse . data [ 0 ] ?. lastUpdatedAt ) ;
434441 setLastUpdated ( date . toLocaleString ( ) ) ;
435442
You can’t perform that action at this time.
0 commit comments