From b450648caa0d1bd5c91e67a33153bbacaf57f006 Mon Sep 17 00:00:00 2001 From: nsfisis Date: Sat, 10 Aug 2024 00:14:17 +0900 Subject: feat: prepend base path --- frontend/app/.server/api/client.ts | 4 ++-- frontend/app/components/GolfPlayApp.client.tsx | 5 ++--- frontend/app/components/GolfWatchApp.client.tsx | 5 ++--- frontend/app/routes/dashboard.tsx | 4 ++-- frontend/vite.config.ts | 1 + 5 files changed, 9 insertions(+), 10 deletions(-) (limited to 'frontend') diff --git a/frontend/app/.server/api/client.ts b/frontend/app/.server/api/client.ts index aae1723..1c96b7b 100644 --- a/frontend/app/.server/api/client.ts +++ b/frontend/app/.server/api/client.ts @@ -4,8 +4,8 @@ import type { paths } from "./schema"; const apiClient = createClient({ baseUrl: process.env.NODE_ENV === "development" - ? "http://localhost:8002/api/" - : "http://api-server/api/", + ? "http://localhost:8002/iosdc-japan/2024/code-battle/api/" + : "http://api-server/iosdc-japan/2024/code-battle/api/", }); export async function apiPostLogin( diff --git a/frontend/app/components/GolfPlayApp.client.tsx b/frontend/app/components/GolfPlayApp.client.tsx index 911fae0..43828e6 100644 --- a/frontend/app/components/GolfPlayApp.client.tsx +++ b/frontend/app/components/GolfPlayApp.client.tsx @@ -22,11 +22,10 @@ export default function GolfPlayApp({ game: Game; sockToken: string; }) { - // const socketUrl = `wss://t.nil.ninja/iosdc-japan/2024/sock/golf/${game.game_id}/play?token=${sockToken}`; const socketUrl = process.env.NODE_ENV === "development" - ? `ws://localhost:8002/sock/golf/${game.game_id}/play?token=${sockToken}` - : `ws://api-server/sock/golf/${game.game_id}/play?token=${sockToken}`; + ? `ws://localhost:8002/iosdc-japan/2024/code-battle/sock/golf/${game.game_id}/play?token=${sockToken}` + : `wss://t.nil.ninja/iosdc-japan/2024/code-battle/sock/golf/${game.game_id}/play?token=${sockToken}`; const { sendJsonMessage, lastJsonMessage, readyState } = useWebSocket(socketUrl, {}); diff --git a/frontend/app/components/GolfWatchApp.client.tsx b/frontend/app/components/GolfWatchApp.client.tsx index aefe945..829f709 100644 --- a/frontend/app/components/GolfWatchApp.client.tsx +++ b/frontend/app/components/GolfWatchApp.client.tsx @@ -20,11 +20,10 @@ export default function GolfWatchApp({ game: Game; sockToken: string; }) { - // const socketUrl = `wss://t.nil.ninja/iosdc-japan/2024/sock/golf/${game.game_id}/watch?token=${sockToken}`; const socketUrl = process.env.NODE_ENV === "development" - ? `ws://localhost:8002/sock/golf/${game.game_id}/watch?token=${sockToken}` - : `ws://api-server/sock/golf/${game.game_id}/watch?token=${sockToken}`; + ? `ws://localhost:8002/iosdc-japan/2024/code-battle/sock/golf/${game.game_id}/watch?token=${sockToken}` + : `wss://t.nil.ninja/iosdc-japan/2024/code-battle/sock/golf/${game.game_id}/watch?token=${sockToken}`; const { lastJsonMessage, readyState } = useWebSocket( socketUrl, diff --git a/frontend/app/routes/dashboard.tsx b/frontend/app/routes/dashboard.tsx index e6a43de..d69018a 100644 --- a/frontend/app/routes/dashboard.tsx +++ b/frontend/app/routes/dashboard.tsx @@ -13,8 +13,8 @@ export async function loader({ request }: LoaderFunctionArgs) { if (user.is_admin) { return redirect( process.env.NODE_ENV === "development" - ? "http://localhost:8002/admin/dashboard" - : "/admin/dashboard", + ? "http://localhost:8002/iosdc-japan/2024/code-battle/admin/dashboard" + : "/iosdc-japan/2024/code-battle/admin/dashboard", ); } const { games } = await apiGetGames(token); diff --git a/frontend/vite.config.ts b/frontend/vite.config.ts index e07fb91..bb04554 100644 --- a/frontend/vite.config.ts +++ b/frontend/vite.config.ts @@ -10,6 +10,7 @@ export default defineConfig({ v3_relativeSplatPath: true, v3_throwAbortReason: true, }, + basename: "/iosdc-japan/2024/code-battle/", }), tsconfigPaths(), ], -- cgit v1.2.3-70-g09d2