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 <noreply@anthropic.com>
This commit is contained in:
natib21
2026-06-30 13:10:47 +00:00
parent 373c0356f2
commit 8e0cc7d5ee
2 changed files with 8 additions and 2 deletions

View File

@@ -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({

View File

@@ -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({