Changeset 299af01 for src/sections/invoice/view/invoice-list-view.tsx
- Timestamp:
- 02/26/25 14:27:26 (6 weeks ago)
- Branches:
- main
- Children:
- 3c5302a
- Parents:
- 057453c
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
src/sections/invoice/view/invoice-list-view.tsx
r057453c r299af01 49 49 import InvoiceTableToolbar from '../invoice-table-toolbar'; 50 50 import MailCompose from '../mail-compose'; 51 import { useFetchAnalytics } from 'src/api/invoice/use-fetch-analytics'; 52 import { endpoints } from 'src/utils/axios'; 51 53 52 54 // ---------------------------------------------------------------------- … … 208 210 // ); 209 211 212 const { 213 analytics: analyticsData, 214 isAnalyticsLoading, 215 analyticsError, 216 } = useFetchAnalytics(filters.startDate); 217 210 218 useEffect(() => { 211 if (tableData) { 212 const getAnalytics = async () => { 213 const analyticsStats = await getTotalAmountForAllStatuses(tableData); 214 setAnalytics(analyticsStats); 215 }; 216 getAnalytics(); 219 if (analyticsData) { 220 setAnalytics(analyticsData); 217 221 } 218 }, [tableData]); 222 }, [analyticsData]); 223 224 useEffect(() => { 225 if (analyticsError) { 226 console.error('Failed to load analytics:', analyticsError); 227 } 228 }, [analyticsError]); 219 229 220 230 const getPercentByStatus = (status: string) => … … 272 282 await deleteInvoiceMutation(invoice.id); 273 283 await deleteFromFirebaseStorage( 274 `invoices/${invoice.invoiceTo.name} /${invoice.id}-${invoice.invoiceNumber}.pdf`284 `invoices/${invoice.invoiceTo.name}-${invoice.invoiceNumber}.pdf` 275 285 ); 276 286 277 mutate( invoiceMutationKey);287 mutate(endpoints.invoice); 278 288 }, 279 289 [filters.startDate, invoiceMutationKey] … … 332 342 setFilters(defaultFilters); 333 343 }, []); 344 345 if (isAnalyticsLoading) { 346 // Show loading state 347 } 334 348 335 349 return (
Note:
See TracChangeset
for help on using the changeset viewer.