RTOPP / frontend /src /components /ProtectedRoute.tsx
vinay-pepakayala's picture
Upload 84 files
a247911 verified
Raw
History Blame Contribute Delete
256 Bytes
import { Navigate, Outlet } from 'react-router-dom';
import { useAuth } from '../context/AuthContext';
export function ProtectedRoute() {
const { isAuthenticated } = useAuth();
return isAuthenticated ? <Outlet /> : <Navigate to="/login" replace />;
}