design
This commit is contained in:
@@ -546,11 +546,23 @@ export function useStaff(tenantid: number | undefined) {
|
||||
* Fanned out because `getposusers` takes a single `locationid` — the same
|
||||
* constraint as every other POS read.
|
||||
*/
|
||||
export function usePosUsersByBranch(tenantid: number | undefined, locationIds: readonly number[]) {
|
||||
/**
|
||||
* Till accounts, per branch.
|
||||
*
|
||||
* `includeInactive` is opt-in and part of the cache key, so a page that wants
|
||||
* to keep a switched-off cashier on screen gets them without changing what
|
||||
* every other caller sees — see `posUsersApi.list` for why the default stayed
|
||||
* as it was.
|
||||
*/
|
||||
export function usePosUsersByBranch(
|
||||
tenantid: number | undefined,
|
||||
locationIds: readonly number[],
|
||||
includeInactive = false,
|
||||
) {
|
||||
return useQueries({
|
||||
queries: locationIds.map((locationid) => ({
|
||||
queryKey: queryKeys.people.posUsers(tenantid ?? 0, locationid),
|
||||
queryFn: () => posUsersApi.list(tenantid as number, locationid),
|
||||
queryKey: [...queryKeys.people.posUsers(tenantid ?? 0, locationid), includeInactive] as const,
|
||||
queryFn: () => posUsersApi.list(tenantid as number, locationid, includeInactive),
|
||||
enabled: Boolean(tenantid),
|
||||
...stable,
|
||||
})),
|
||||
|
||||
Reference in New Issue
Block a user