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 (