aboutsummaryrefslogtreecommitdiffhomepage
path: root/frontend/app/routes/golf.$gameId.play.tsx
diff options
context:
space:
mode:
authornsfisis <nsfisis@gmail.com>2024-08-01 22:43:27 +0900
committernsfisis <nsfisis@gmail.com>2024-08-01 23:12:07 +0900
commit3d566086003efd952cd1535ee9d971dab5d58a15 (patch)
tree2576c94ab3fba3820bd7ef765ef22a035581d9ba /frontend/app/routes/golf.$gameId.play.tsx
parent13e9a10c1964bc40c698efa7bc8e47acc5cb25b4 (diff)
downloadphperkaigi-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/golf.$gameId.play.tsx')
-rw-r--r--frontend/app/routes/golf.$gameId.play.tsx6
1 files changed, 2 insertions, 4 deletions
diff --git a/frontend/app/routes/golf.$gameId.play.tsx b/frontend/app/routes/golf.$gameId.play.tsx
index d498200..72f66bc 100644
--- a/frontend/app/routes/golf.$gameId.play.tsx
+++ b/frontend/app/routes/golf.$gameId.play.tsx
@@ -2,7 +2,7 @@ import type { LoaderFunctionArgs, MetaFunction } from "@remix-run/node";
import { useLoaderData } from "@remix-run/react";
import { ClientOnly } from "remix-utils/client-only";
import { apiGetGame, apiGetToken } from "../.server/api/client";
-import { isAuthenticated } from "../.server/auth";
+import { ensureUserLoggedIn } from "../.server/auth";
import GolfPlayApp from "../components/GolfPlayApp.client";
import GolfPlayAppConnecting from "../components/GolfPlayApps/GolfPlayAppConnecting";
@@ -17,9 +17,7 @@ export const meta: MetaFunction<typeof loader> = ({ data }) => {
};
export async function loader({ params, request }: LoaderFunctionArgs) {
- const { token } = await isAuthenticated(request, {
- failureRedirect: "/login",
- });
+ const { token } = await ensureUserLoggedIn(request);
const fetchGame = async () => {
return (await apiGetGame(token, Number(params.gameId))).game;