Files
baya-monorepo/client/src/services/refunds/keys.ts
T
2026-07-10 12:51:53 +03:30

19 lines
887 B
TypeScript

/**
* React Query key factory for the refunds domain (hierarchical, per the `services/{domain}` pattern).
* The cancellation preview and the refund status are keyed by the **booking** id (the customer reaches a
* refund through its booking, never through an admin-only refund id); `detail` keys the by-refund-id read
* used by the real `refunds/{id}/status` route.
*/
export const refundKeys = {
all: ['refunds'] as const,
policyPreviews: () => [...refundKeys.all, 'policy_preview'] as const,
policyPreview: (bookingId: number) => [...refundKeys.policyPreviews(), bookingId] as const,
byBookings: () => [...refundKeys.all, 'by_booking'] as const,
byBooking: (bookingId: number) => [...refundKeys.byBookings(), bookingId] as const,
details: () => [...refundKeys.all, 'detail'] as const,
detail: (refundId: number) => [...refundKeys.details(), refundId] as const,
};