From 8e0cc7d5ee37bf720c42d4431bdda95c19e4a7d2 Mon Sep 17 00:00:00 2001 From: natib21 Date: Tue, 30 Jun 2026 13:10:47 +0000 Subject: [PATCH] fix: vehicles data extraction in maintenance + financial pages Both MaintenancePage and FinancialReportsPage were calling vehiclesService.getAll() but not extracting res.data property. Result was vehicles being undefined, causing .map error. Fixed to match FuelPurchasePage pattern: const res = await vehiclesService.getAll() return res.data || [] Co-Authored-By: Claude Haiku 4.5 --- .../backoffice/src/pages/fleet/FinancialReportsPage.tsx | 5 ++++- .../backoffice/src/pages/fleet/MaintenancePage.tsx | 5 ++++- 2 files changed, 8 insertions(+), 2 deletions(-) diff --git a/apps/edr-freight-web/backoffice/src/pages/fleet/FinancialReportsPage.tsx b/apps/edr-freight-web/backoffice/src/pages/fleet/FinancialReportsPage.tsx index 31d7a7a23..729c50427 100644 --- a/apps/edr-freight-web/backoffice/src/pages/fleet/FinancialReportsPage.tsx +++ b/apps/edr-freight-web/backoffice/src/pages/fleet/FinancialReportsPage.tsx @@ -36,7 +36,10 @@ export function FinancialReportsPage() { const { data: vehicles } = useQuery({ queryKey: QUERY_KEYS.VEHICLES.list(), - queryFn: () => vehiclesService.getAll({ limit: 1000 }), + queryFn: async () => { + const res = await vehiclesService.getAll({ limit: 1000 }); + return res.data || []; + }, }); const { data: fuelStats } = useQuery({ diff --git a/apps/edr-freight-web/backoffice/src/pages/fleet/MaintenancePage.tsx b/apps/edr-freight-web/backoffice/src/pages/fleet/MaintenancePage.tsx index 162ee5f21..d94ed375c 100644 --- a/apps/edr-freight-web/backoffice/src/pages/fleet/MaintenancePage.tsx +++ b/apps/edr-freight-web/backoffice/src/pages/fleet/MaintenancePage.tsx @@ -35,7 +35,10 @@ export function MaintenancePage() { const { data: vehicles } = useQuery({ queryKey: QUERY_KEYS.VEHICLES.list(), - queryFn: () => vehiclesService.getAll({ limit: 1000 }), + queryFn: async () => { + const res = await vehiclesService.getAll({ limit: 1000 }); + return res.data || []; + }, }); const { data: upcoming, isLoading } = useQuery({