diff options
| author | nsfisis <nsfisis@gmail.com> | 2024-08-01 23:34:59 +0900 |
|---|---|---|
| committer | nsfisis <nsfisis@gmail.com> | 2024-08-01 23:34:59 +0900 |
| commit | db06c9332776b41b3fef537f9e6d76d38f0463b3 (patch) | |
| tree | b25c8226efa42be3e631cdf2f047c13c1b807889 /frontend/app/routes/admin.dashboard.tsx | |
| parent | 6b600ca0ca50c9322a95858bd7d4b6813a7ba2d5 (diff) | |
| parent | ca4e86c99a935c41b319efea43365221569c7d62 (diff) | |
| download | iosdc-japan-2024-albatross-db06c9332776b41b3fef537f9e6d76d38f0463b3.tar.gz iosdc-japan-2024-albatross-db06c9332776b41b3fef537f9e6d76d38f0463b3.tar.zst iosdc-japan-2024-albatross-db06c9332776b41b3fef537f9e6d76d38f0463b3.zip | |
Merge branch 'feat/auth'
Diffstat (limited to 'frontend/app/routes/admin.dashboard.tsx')
| -rw-r--r-- | frontend/app/routes/admin.dashboard.tsx | 14 |
1 files changed, 6 insertions, 8 deletions
diff --git a/frontend/app/routes/admin.dashboard.tsx b/frontend/app/routes/admin.dashboard.tsx index ce3e910..f91406f 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 { Form, Link } from "@remix-run/react"; +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; } @@ -26,6 +21,9 @@ export default function AdminDashboard() { <p> <Link to="/admin/games">Games</Link> </p> + <Form method="post" action="/logout"> + <button type="submit">Logout</button> + </Form> </div> ); } |
