/** * Protected Route Component * Redirects to login if user is not authenticated */ "use client" import { useAuth } from "@/lib/auth-context" import { useRouter } from "next/navigation" import { useEffect } from "react" export function ProtectedRoute({ children }: { children: React.ReactNode }) { const { isAuthenticated, isLoading } = useAuth() const router = useRouter() useEffect(() => { if (!isLoading && !isAuthenticated) { router.replace("/auth/login") } }, [isAuthenticated, isLoading, router]) if (isLoading) { return (
Vérification de l'authentification...