category changes
This commit is contained in:
@@ -18,6 +18,7 @@ import { stockApi, type StockRequestQuery } from '@/api/stock';
|
||||
import { tenantsApi, utilsApi, type TenantListQuery } from '@/api/tenants';
|
||||
import { customersApi, type CustomerQuery } from '@/api/customers';
|
||||
import { uploadsApi } from '@/api/uploads';
|
||||
import { APP_BROWSE_CATEGORY } from '@/features/catalogue/tenantCategories';
|
||||
import { queryKeys } from './keys';
|
||||
import { LIVE_REFETCH_MS } from './interval';
|
||||
|
||||
@@ -138,15 +139,17 @@ export function useImportedRefs(tenantid: number | undefined) {
|
||||
/* ── Products ────────────────────────────────────────────────────────────── */
|
||||
|
||||
/**
|
||||
* The tenant's categories as they are actually used.
|
||||
* The ten aisles the customer app groups products into.
|
||||
*
|
||||
* Prefer this over `products/getproductcategories`, the master table missing
|
||||
* rows for live categoryids and hardcoded to `moduleid = 2`.
|
||||
* `productsubcategories` for category 2 — platform rows, the same ten for
|
||||
* every tenant, so the tenantid only satisfies the endpoint's signature. This
|
||||
* is the list `getproductsbysubcategory` buckets against, which makes it the
|
||||
* one the console has to name products from too; see `appAisle.ts`.
|
||||
*/
|
||||
export function useTenantCategories(tenantid: number | undefined) {
|
||||
export function useAppAisles(tenantid: number | undefined) {
|
||||
return useQuery({
|
||||
queryKey: queryKeys.products.tenantCategories(tenantid ?? 0),
|
||||
queryFn: () => productsApi.tenantCategories(tenantid as number),
|
||||
queryKey: queryKeys.products.subCategories(tenantid ?? 0, APP_BROWSE_CATEGORY),
|
||||
queryFn: () => productsApi.subCategories(tenantid as number, APP_BROWSE_CATEGORY),
|
||||
enabled: typeof tenantid === 'number' && tenantid > 0,
|
||||
...stable,
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user