mirror of
https://github.com/Tria-plc/edr-platform.git
synced 2026-08-27 00:52:50 +00:00
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:
@@ -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({
|
||||
|
||||
@@ -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({
|
||||
|
||||
Reference in New Issue
Block a user