diff options
Diffstat (limited to 'frontend/app/routes/admin.dashboard.tsx')
| -rw-r--r-- | frontend/app/routes/admin.dashboard.tsx | 9 |
1 files changed, 2 insertions, 7 deletions
diff --git a/frontend/app/routes/admin.dashboard.tsx b/frontend/app/routes/admin.dashboard.tsx index ce3e910..4eb90b5 100644 --- a/frontend/app/routes/admin.dashboard.tsx +++ b/frontend/app/routes/admin.dashboard.tsx @@ -1,18 +1,13 @@ import type { LoaderFunctionArgs, MetaFunction } from "@remix-run/node"; import { Link } from "@remix-run/react"; -import { isAuthenticated } from "../.server/auth"; +import { ensureAdminUserLoggedIn } from "../.server/auth"; export const meta: MetaFunction = () => { return [{ title: "[Admin] Dashboard | iOSDC Japan 2024 Albatross.swift" }]; }; export async function loader({ request }: LoaderFunctionArgs) { - const { user } = await isAuthenticated(request, { - failureRedirect: "/login", - }); - if (!user.is_admin) { - throw new Error("Unauthorized"); - } + await ensureAdminUserLoggedIn(request); return null; } |
