import { Navigate, useLocation } from 'react-router-dom'; import { useAuth } from './AuthContext'; interface ProtectedRouteProps { children: React.ReactNode; } export function ProtectedRoute({ children }: ProtectedRouteProps) { const { isAuthenticated, isCheckingAuth } = useAuth(); const location = useLocation(); if (isCheckingAuth) { return
Loading...
; } if (!isAuthenticated) { return ; } return children; }