import { Navigate } from 'react-router-dom'; import { useAuth } from '../context/AuthContext'; export default function PrivateRoute({ children, allowedRoles }) { const { isAuthenticated, role } = useAuth(); if (!isAuthenticated) return ; if (allowedRoles && !allowedRoles.includes(role)) return ; return children; }