diff options
| author | nsfisis <nsfisis@gmail.com> | 2024-08-01 22:43:27 +0900 |
|---|---|---|
| committer | nsfisis <nsfisis@gmail.com> | 2024-08-01 23:12:07 +0900 |
| commit | 3d566086003efd952cd1535ee9d971dab5d58a15 (patch) | |
| tree | 2576c94ab3fba3820bd7ef765ef22a035581d9ba /frontend/app/routes/dashboard.tsx | |
| parent | 13e9a10c1964bc40c698efa7bc8e47acc5cb25b4 (diff) | |
| download | phperkaigi-2025-albatross-3d566086003efd952cd1535ee9d971dab5d58a15.tar.gz phperkaigi-2025-albatross-3d566086003efd952cd1535ee9d971dab5d58a15.tar.zst phperkaigi-2025-albatross-3d566086003efd952cd1535ee9d971dab5d58a15.zip | |
refactor(frontend): simplify login check
Diffstat (limited to 'frontend/app/routes/dashboard.tsx')
| -rw-r--r-- | frontend/app/routes/dashboard.tsx | 6 |
1 files changed, 2 insertions, 4 deletions
diff --git a/frontend/app/routes/dashboard.tsx b/frontend/app/routes/dashboard.tsx index 1c2137d..45381e1 100644 --- a/frontend/app/routes/dashboard.tsx +++ b/frontend/app/routes/dashboard.tsx @@ -2,16 +2,14 @@ import type { LoaderFunctionArgs, MetaFunction } from "@remix-run/node"; import { redirect } from "@remix-run/node"; import { Form, Link, useLoaderData } from "@remix-run/react"; import { apiGetGames } from "../.server/api/client"; -import { isAuthenticated } from "../.server/auth"; +import { ensureUserLoggedIn } from "../.server/auth"; export const meta: MetaFunction = () => { return [{ title: "Dashboard | iOSDC Japan 2024 Albatross.swift" }]; }; export async function loader({ request }: LoaderFunctionArgs) { - const { user, token } = await isAuthenticated(request, { - failureRedirect: "/login", - }); + const { user, token } = await ensureUserLoggedIn(request); if (user.is_admin) { return redirect("/admin/dashboard"); } |
