updates on the reverse logistics
This commit is contained in:
@@ -108,6 +108,9 @@ const BOOKING_KEYS = [
|
||||
['doormile', 'bookings'],
|
||||
['doormile', 'deliveries'],
|
||||
['doormile', 'delivery-counts'],
|
||||
// A parcel's timeline (ConsignmentTimeline), so a status change made from
|
||||
// Deliveries shows in an open order drawer at once.
|
||||
['doormile', 'returns', 'history'],
|
||||
];
|
||||
|
||||
/* ── Dashboard, reports, profile ──────────────────────────────────────────── */
|
||||
@@ -557,6 +560,25 @@ export const useReturns = (params = {}, options) =>
|
||||
...options,
|
||||
});
|
||||
|
||||
/* Both live under the returns key, so every return action above refreshes them. */
|
||||
export const useReturnsSummary = (params = {}, options) =>
|
||||
useQuery({
|
||||
queryKey: ['doormile', 'returns', 'summary', params],
|
||||
queryFn: () => api.getReturnsSummary(params),
|
||||
placeholderData: (previous) => previous,
|
||||
staleTime: 60_000,
|
||||
...options,
|
||||
});
|
||||
|
||||
export const useConsignmentHistory = (consignmentId, options) =>
|
||||
useQuery({
|
||||
queryKey: ['doormile', 'returns', 'history', String(consignmentId)],
|
||||
queryFn: () => api.getConsignmentHistory(consignmentId),
|
||||
enabled: !!consignmentId,
|
||||
staleTime: 15_000,
|
||||
...options,
|
||||
});
|
||||
|
||||
export const useInitiateRto = () =>
|
||||
useDoormileMutation({
|
||||
mutationFn: ({ consignmentId, reason, note }) => api.initiateRto(consignmentId, { reason, note }),
|
||||
|
||||
Reference in New Issue
Block a user