Files
compras/resources/js/hooks/use-inventory-preparation-identity.ts
T
nala eb32c74c56
tests / ci (push) Waiting to run
commit compras1 2811
2026-11-28 07:11:35 +02:00

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}`;
}