From 63d65d60fc121d6dfc2cdb6a2e23462a989880e0 Mon Sep 17 00:00:00 2001
From: nsfisis <nsfisis@gmail.com>
Date: Mon, 5 Aug 2024 03:06:21 +0900
Subject: feat(frontend): disallow to access watch page in multiplayer mode

---
 frontend/app/routes/golf.$gameId.watch.tsx | 5 +++++
 1 file changed, 5 insertions(+)

(limited to 'frontend/app/routes/golf.$gameId.watch.tsx')

diff --git a/frontend/app/routes/golf.$gameId.watch.tsx b/frontend/app/routes/golf.$gameId.watch.tsx
index 83b7a1a..5edf92f 100644
--- a/frontend/app/routes/golf.$gameId.watch.tsx
+++ b/frontend/app/routes/golf.$gameId.watch.tsx
@@ -25,6 +25,11 @@ export async function loader({ params, request }: LoaderFunctionArgs) {
 	};
 
 	const [game, sockToken] = await Promise.all([fetchGame(), fetchSockToken()]);
+
+	if (game.game_type !== "1v1") {
+		return new Response("Not Found", { status: 404 });
+	}
+
 	return {
 		game,
 		sockToken,
-- 
cgit v1.2.3-70-g09d2

