import React from 'react'; import { Navigate } from 'react-router-dom'; import { useAuth } from '../context/AuthContext'; const ProtectedRoute = ({ children, roles }) => { const { user } = useAuth(); if (!user) { return ; } if (roles && !roles.includes(user.role)) { return ; } return children; }; export default ProtectedRoute;