10 lines
483 B
TypeScript
10 lines
483 B
TypeScript
import { usePage } from '@inertiajs/react';
|
|
import type { WorkContextState } from '@/types/work-context';
|
|
|
|
export function useInventoryPreparationIdentity(scope: string) {
|
|
const { auth, workContext, actorId } = usePage().props;
|
|
const context = workContext as WorkContextState | null | undefined;
|
|
const actor = typeof actorId === 'number' ? actorId : auth.user?.id;
|
|
return `inventory-events:${auth.user?.tenant_id}:${actor}:${context?.active ?? 'legacy'}:${scope}`;
|
|
}
|