import { ReactNode } from 'react'; import { Navigate } from 'react-router-dom'; import { useAuth } from '@/contexts/AuthContext'; interface ProtectedRouteProps { children: ReactNode; } export function ProtectedRoute({ children }: ProtectedRouteProps) { const { isAuthenticated, isLoading, isApproved, backendUser, authError, logout } = useAuth(); // Show loading while Auth0 is loading OR while fetching backend user profile if (isLoading) { return (
Loading...
{authError}
Loading user profile...