Squash merge PR #23. Included changes: - complete occupancy check-in required fields/default payload - improve responsive admin management pages - fix attendance edge cases and attendance period config - refine wallet/finance-related workflow handling Checks: - npm run typecheck -w apps/admin - npm run typecheck -w apps/server
18 lines
555 B
TypeScript
18 lines
555 B
TypeScript
export const PERMISSIONS_UPDATED_EVENT = 'permissions-updated';
|
|
|
|
export function readPermissions(): string[] {
|
|
try {
|
|
const value = JSON.parse(localStorage.getItem('permissions') || '[]');
|
|
return Array.isArray(value)
|
|
? value.filter((item): item is string => typeof item === 'string')
|
|
: [];
|
|
} catch {
|
|
return [];
|
|
}
|
|
}
|
|
|
|
export function writePermissions(permissions: string[]): void {
|
|
localStorage.setItem('permissions', JSON.stringify([...new Set(permissions)]));
|
|
window.dispatchEvent(new Event(PERMISSIONS_UPDATED_EVENT));
|
|
}
|