Fe changes
This commit is contained in:
@@ -12,6 +12,8 @@ import type {
|
||||
RouteVisitResponse,
|
||||
VehicleResponse,
|
||||
WarehouseResponse,
|
||||
WarehouseDashboardResponse,
|
||||
VehicleDashboardResponse,
|
||||
VehicleType,
|
||||
WarehouseType,
|
||||
} from '@/types/api'
|
||||
@@ -199,6 +201,10 @@ export const vehicles = {
|
||||
get: (id: string) =>
|
||||
api.get<VehicleResponse>(`/vehicles/${id}`).then(r => normalizeVehicle(r.data)),
|
||||
|
||||
dashboard: (id: string, params?: { from?: string; to?: string }) =>
|
||||
api.get<VehicleDashboardResponse>(`/vehicles/${id}/dashboard`, { params })
|
||||
.then(r => ({ ...r.data, vehicle: normalizeVehicle(r.data.vehicle) })),
|
||||
|
||||
create: (body: VehicleBody) =>
|
||||
api.post<VehicleResponse>('/vehicles', serializeVehicleBody(body)).then(r => normalizeVehicle(r.data)),
|
||||
|
||||
@@ -226,6 +232,9 @@ export const warehouses = {
|
||||
get: (id: string) =>
|
||||
api.get<WarehouseResponse>(`/warehouses/${id}`).then(r => r.data),
|
||||
|
||||
dashboard: (id: string, params?: { from?: string; to?: string; deadStockDays?: number }) =>
|
||||
api.get<WarehouseDashboardResponse>(`/warehouses/${id}/dashboard`, { params }).then(r => r.data),
|
||||
|
||||
create: (body: WarehouseBody) =>
|
||||
api.post<WarehouseResponse>('/warehouses', body).then(r => r.data),
|
||||
|
||||
|
||||
Reference in New Issue
Block a user