10 lines
570 B
TypeScript
10 lines
570 B
TypeScript
import { usePage } from '@inertiajs/react';
|
|
import type { WorkContextState } from '@/types/work-context';
|
|
|
|
export function useProcurementPreparationIdentity(scope: string) {
|
|
const { auth, workContext, organizationAccess } = usePage().props;
|
|
const context = workContext as WorkContextState | null | undefined;
|
|
const access = organizationAccess as { permissions?: string[] } | null;
|
|
return `procurement-preparations:${auth?.user?.tenant_id}:${auth?.user?.id}:${context?.active ?? 'legacy'}:${[...(access?.permissions ?? [])].sort().join(',')}:${scope}`;
|
|
}
|