diff --git a/client/src/pages/AdminDashboard.tsx b/client/src/pages/AdminDashboard.tsx index 93e295a..3014098 100644 --- a/client/src/pages/AdminDashboard.tsx +++ b/client/src/pages/AdminDashboard.tsx @@ -10,9 +10,9 @@ export default function AdminDashboard() { const { user, isLoading } = useAuth(); const { toast } = useToast(); - // Redirect if not authenticated or not admin + // Redirect if not authenticated or not admin/superadmin useEffect(() => { - if (!isLoading && (!user || user.role !== 'admin')) { + if (!isLoading && (!user || (user.role !== 'admin' && user.role !== 'superadmin'))) { toast({ title: "Unauthorized", description: "You don't have permission to access this page.", @@ -47,7 +47,7 @@ export default function AdminDashboard() { window.location.href = "/api/logout"; }; - if (isLoading || !user || user.role !== 'admin') { + if (isLoading || !user || (user.role !== 'admin' && user.role !== 'superadmin')) { return (
diff --git a/client/src/pages/Home.tsx b/client/src/pages/Home.tsx index 5126b6d..3063286 100644 --- a/client/src/pages/Home.tsx +++ b/client/src/pages/Home.tsx @@ -11,6 +11,10 @@ export default function Home() { window.location.href = "/api/logout"; }; + const handleAdminPage = () => { + window.location.href = "/admin"; + }; + return (
{/* Header */} @@ -41,7 +45,7 @@ export default function Home() {