@@ -0,0 +1,10 @@
|
||||
import { usePage } from '@inertiajs/react';
|
||||
import type { WorkContextState } from '@/types/work-context';
|
||||
|
||||
export function useBudgetPreparationIdentity() {
|
||||
const { auth, workContext, organizationAccess } = usePage().props;
|
||||
const context = workContext as WorkContextState | null | undefined;
|
||||
const access = organizationAccess as { permissions?: string[] } | null;
|
||||
const permissions = [...(access?.permissions ?? [])].sort().join(',');
|
||||
return `budgets:${auth.user?.tenant_id}:${auth.user?.id}:${context?.active ?? 'legacy'}:${permissions}`;
|
||||
}
|
||||
Reference in New Issue
Block a user