This commit is contained in:
2026-09-01 12:00:46 +05:30
parent fe78c54eeb
commit a8e0dc069f
20 changed files with 1278 additions and 32 deletions

View File

@@ -16,6 +16,7 @@ import { posUsersApi, staffApi } from '@/api/people';
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 { queryKeys } from './keys';
import { LIVE_REFETCH_MS } from './interval';
@@ -401,3 +402,29 @@ export function useStaffShifts(tenantid: number | undefined, locationid: number
...stable,
});
}
/**
* The signed-in merchant's own business record.
*
* `gettenantinfo`, not `listAll`. The latter is `getalltenants` — paginated
* across 262 merchants — so a shop on page two was simply not found, and a
* profile screen built on it would show nothing with no visible reason why.
*/
export function useOwnTenant(tenantid: number | undefined) {
return useQuery({
queryKey: queryKeys.tenants.byId(tenantid ?? 0),
queryFn: () => tenantsApi.byId(tenantid as number),
enabled: Boolean(tenantid),
...stable,
});
}
/** Upload receipts for a shop — used by the Uploads page and the setup checklist. */
export function useUploads(tenantid: number | undefined, locationid?: number) {
return useQuery({
queryKey: queryKeys.uploads.list(tenantid ?? 0, locationid ?? 0),
queryFn: () => uploadsApi.list({ tenantid, ...(locationid ? { locationid } : {}) }),
enabled: Boolean(tenantid),
...stable,
});
}