import { Navigate } from 'react-router-dom';
import { useAuth } from '../hooks/useAuth';
export default function ProtectedRoute({ children }: { children: React.ReactNode }) {
const { isAuthenticated } = useAuth();
if (!isAuthenticated) {
return ;
}
return <>{children}>;
}
export function RoleGuard({ roles, children }: { roles: string[]; children: React.ReactNode }) {
const { user } = useAuth();
if (!user || !roles.includes(user.role)) {
return ;
}
return <>{children}>;
}