import type { ReactNode } from 'react' import { Link, Navigate, useLocation } from 'react-router-dom' import { useAuth } from './AuthContext' import type { AuthUser } from '../lib/types' type RequiredRole = 'admin' | 'view' | 'management' export function ManagementGate({ children, role = 'management', }: { children: ReactNode role?: RequiredRole }) { const { loading, user } = useAuth() const location = useLocation() if (loading) { return
Checking sign-in…
} if (!user) { returnYour account does not have the {roleName} permission required for this page.
Back to forms