import React from 'react'; import { Navigate, useLocation } from 'react-router-dom'; import { useAuth } from '../contexts/AuthContext'; interface ProtectedRouteProps { children: React.ReactNode; } const ProtectedRoute: React.FC = ({ children }) => { const { isAuthenticated, loading } = useAuth(); const location = useLocation(); if (loading) { return (
); } if (!isAuthenticated) { return ; } return <>{children}; }; export default ProtectedRoute;