mirror of
https://github.com/Tria-plc/edr-platform.git
synced 2026-09-09 01:18:18 +00:00
Card called GET /warehouse-inventory (staff perm) → 403 swallowed as
empty state. New customer-safe bookings/:id/location endpoint returns location fields only; card now uses it.
This commit is contained in:
@@ -23,8 +23,8 @@ function Row({ label, value }: { label: string; value: React.ReactNode }) {
|
||||
|
||||
export function WarehouseLocationCard({ bookingId }: WarehouseLocationCardProps) {
|
||||
const { data, isLoading } = useQuery({
|
||||
queryKey: ["warehouse-inventory", bookingId],
|
||||
queryFn: () => warehouseService.listInventory({ bookingId }),
|
||||
queryKey: ["warehouse-inventory", "booking-location", bookingId],
|
||||
queryFn: () => warehouseService.bookingLocation(bookingId),
|
||||
});
|
||||
|
||||
const items = data ?? [];
|
||||
|
||||
@@ -49,6 +49,12 @@ export const warehouseService = {
|
||||
return data?.data ?? data ?? [];
|
||||
},
|
||||
|
||||
/** Customer-safe location endpoint — the plain list is staff-only (403 for portal users). */
|
||||
bookingLocation: async (bookingId: string): Promise<WarehouseInventoryItem[]> => {
|
||||
const { data } = await client.get(`/warehouse-inventory/bookings/${bookingId}/location`);
|
||||
return data?.data ?? data ?? [];
|
||||
},
|
||||
|
||||
bookingSchedule: async (bookingId: string): Promise<BookingScheduleView> => {
|
||||
const { data } = await client.get(`/warehouse-inventory/booking-schedule/${bookingId}`);
|
||||
return data?.data ?? data ?? { schedule: null, wagon: null };
|
||||
|
||||
Reference in New Issue
Block a user