updates on the bookings page and updated ai and more thngs
This commit is contained in:
@@ -259,6 +259,27 @@ export const useHubs = (options) =>
|
||||
export const useHub = (id, options) =>
|
||||
useQuery({ queryKey: KEYS.hub(id), queryFn: () => api.getHub(id), enabled: !!id, ...options });
|
||||
|
||||
/**
|
||||
* The facility list used to decide which end of a booking is a hub.
|
||||
*
|
||||
* Lives here rather than in each page so every screen classifies against the
|
||||
* SAME facilities. A page that built its own list from hubs alone would call
|
||||
* every client's kitchen a customer pickup, and the same order would then carry
|
||||
* different labels on Orders and on Dispatch.
|
||||
*
|
||||
* `tenantIds` is sorted into the cache key so the same set of tenants in a
|
||||
* different order is one cache entry, not two.
|
||||
*/
|
||||
export const useFlowAnchors = (tenantIds = [], options) => {
|
||||
const ids = [...new Set((tenantIds || []).filter((id) => id != null).map(String))].sort();
|
||||
return useQuery({
|
||||
queryKey: ['doormile', 'flowAnchors', ids.join(',')],
|
||||
queryFn: () => api.fetchFlowAnchors(ids),
|
||||
staleTime: 5 * 60_000,
|
||||
...options,
|
||||
});
|
||||
};
|
||||
|
||||
export const useCreateHub = () =>
|
||||
useDoormileMutation({ mutationFn: api.createHub, invalidates: [KEYS.hubs], successMessage: 'Hub created' });
|
||||
|
||||
|
||||
Reference in New Issue
Block a user