backend integration started
This commit is contained in:
@@ -99,6 +99,23 @@ export function useCatalogueProducts(query: CatalogueQuery) {
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* The categories inside one brand's table.
|
||||
*
|
||||
* Brand-scoped because the backend reads them from that brand's own table
|
||||
* (`catalogueController.go:38-45` refuses without one) — there is no
|
||||
* catalogue-wide category list to ask for. That is why the rail nests
|
||||
* categories under a brand rather than listing them at the top level.
|
||||
*/
|
||||
export function useCatalogueCategories(brand: string | undefined) {
|
||||
return useQuery({
|
||||
queryKey: queryKeys.catalogue.categories(brand ?? ''),
|
||||
queryFn: () => catalogueApi.categories(brand as string),
|
||||
enabled: Boolean(brand),
|
||||
...stable,
|
||||
});
|
||||
}
|
||||
|
||||
export function useCatalogueBrands() {
|
||||
return useQuery({
|
||||
queryKey: queryKeys.catalogue.brands(),
|
||||
@@ -118,19 +135,10 @@ export function useImportedRefs(tenantid: number | undefined) {
|
||||
|
||||
/* ── Products ────────────────────────────────────────────────────────────── */
|
||||
|
||||
export function useProductCategories(tenantid: number | undefined) {
|
||||
return useQuery({
|
||||
queryKey: queryKeys.products.categories(tenantid ?? 0),
|
||||
queryFn: () => productsApi.categories(tenantid as number),
|
||||
enabled: typeof tenantid === 'number' && tenantid > 0,
|
||||
...stable,
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* The tenant's categories as they are actually used.
|
||||
*
|
||||
* Prefer this over `useProductCategories`, which reads a master table missing
|
||||
* Prefer this over `products/getproductcategories`, the master table missing
|
||||
* rows for live categoryids and hardcoded to `moduleid = 2`.
|
||||
*/
|
||||
export function useTenantCategories(tenantid: number | undefined) {
|
||||
@@ -196,21 +204,6 @@ export function useOrderSummary(tenantid: number | undefined) {
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Till health for one outlet.
|
||||
*
|
||||
* One request per branch — `locationid` is required and singular on the POS
|
||||
* endpoints, so there is no tenant-wide call to reach for.
|
||||
*/
|
||||
export function usePosHealth(locationid: number | undefined) {
|
||||
return useQuery({
|
||||
queryKey: queryKeys.insights.posHealth(locationid ?? 0),
|
||||
queryFn: () => insightsApi.posHealth(locationid as number),
|
||||
enabled: typeof locationid === 'number' && locationid > 0,
|
||||
...live,
|
||||
});
|
||||
}
|
||||
|
||||
/* ── Store Admin: per-branch fan-out ─────────────────────────────────────── */
|
||||
|
||||
/**
|
||||
|
||||
Reference in New Issue
Block a user