File tree Expand file tree Collapse file tree 2 files changed +5
-5
lines changed
Expand file tree Collapse file tree 2 files changed +5
-5
lines changed Original file line number Diff line number Diff line change @@ -10,15 +10,15 @@ export const getRequestItems = async (): Promise<RequestItemData[]> => {
1010
1111 const data = await response . json ( ) ;
1212
13- // Transform API response to match our interface if needed
13+
1414 return data . map ( ( item : any ) => ( {
1515 ...item ,
16- status : item . status . toLowerCase ( ) , // Ensure status matches our enum
16+ status : item . status . toLowerCase ( ) ,
1717 created_on : new Date ( item . created_on ) ,
1818 request_sent_to_obc_on : item . request_sent_to_obc_on ? new Date ( item . request_sent_to_obc_on ) : null ,
1919 pic_taken_on : item . pic_taken_on ? new Date ( item . pic_taken_on ) : null ,
2020 pic_transmitted_on : item . pic_transmitted_on ? new Date ( item . pic_transmitted_on ) : null ,
21- cancellable_after : item . cancellable_after ? new Date ( item . cancellable_after ) : new Date ( ) , // Calculate or get from API
21+ cancellable_after : item . cancellable_after ? new Date ( item . cancellable_after ) : new Date ( ) ,
2222 } ) ) ;
2323 } catch ( error ) {
2424 console . error ( 'Error fetching ARO requests:' , error ) ;
Original file line number Diff line number Diff line change @@ -27,11 +27,11 @@ function Logs() {
2727 try {
2828 const response = await fetch ( `http://localhost:5000/recent-logs/` ) ;
2929 const data = await response . json ( ) ;
30- // Assuming data is either a single log or an array of logs
30+
3131 if ( Array . isArray ( data ) ) {
3232 setLogs ( data . map ( ( item , index ) => ( { ...item , id : index } ) ) ) ;
3333 } else {
34- // If it's a single log entry, create an array with one item
34+
3535 setLogs ( [ { id : 0 , date : data . date , log : data . log } ] ) ;
3636 }
3737 setLoading ( false ) ;
You can’t perform that action at this time.
0 commit comments