diff --git a/client/src/pages/Home.tsx b/client/src/pages/Home.tsx index aba88e1..557f4f8 100644 --- a/client/src/pages/Home.tsx +++ b/client/src/pages/Home.tsx @@ -4,11 +4,18 @@ import { Card, CardContent, CardDescription, CardHeader, CardTitle } from "@/com import { APP_LOGO, APP_TITLE, getLoginUrl } from "@/const"; import { GraduationCap, Calendar, Users, CheckCircle, Mail, Download } from "lucide-react"; import { useLocation } from "wouter"; +import { useEffect } from "react"; export default function Home() { const { user, loading, isAuthenticated } = useAuth(); const [, setLocation] = useLocation(); + useEffect(() => { + if (!loading && isAuthenticated && user?.role === 'admin') { + setLocation('/admin'); + } + }, [loading, isAuthenticated, user?.role, setLocation]); + if (loading) { return (
@@ -18,7 +25,6 @@ export default function Home() { } if (isAuthenticated && user?.role === 'admin') { - setLocation('/admin'); return null; } diff --git a/todo.md b/todo.md index 7d1d6c9..e6ff13f 100644 --- a/todo.md +++ b/todo.md @@ -96,3 +96,7 @@ - [x] Adapter les emails pour inclure toutes les dates de la séquence - [x] Mettre à jour les invitations Outlook pour créer 4 événements si nécessaire - [x] Renommer partout dans l'interface utilisateur (labels, titres, descriptions) + +## Corrections urgentes + +- [x] Corriger l'erreur React "Cannot update a component while rendering" dans Home.tsx