diff options
| author | nsfisis <nsfisis@gmail.com> | 2026-02-13 22:46:05 +0900 |
|---|---|---|
| committer | nsfisis <nsfisis@gmail.com> | 2026-02-13 23:07:26 +0900 |
| commit | 51c2a65ad13f96389997bff8c4db937f42a3b9b3 (patch) | |
| tree | 005c160772dc25ea387e8ab5eaef55766fe60985 | |
| parent | e239fe743fc66a8712cf9886d3dfed3cc41fce36 (diff) | |
| download | phperkaigi-2026-albatross-51c2a65ad13f96389997bff8c4db937f42a3b9b3.tar.gz phperkaigi-2026-albatross-51c2a65ad13f96389997bff8c4db937f42a3b9b3.tar.zst phperkaigi-2026-albatross-51c2a65ad13f96389997bff8c4db937f42a3b9b3.zip | |
refactor(frontend): replace process.env with import.meta.env in API client
BFF前提のURL分岐をVite SPA向けに調整。本番URLのハードコードを
VITE_API_BASE_URL環境変数に外出し。
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
| -rw-r--r-- | frontend/app/api/client.ts | 8 |
1 files changed, 4 insertions, 4 deletions
diff --git a/frontend/app/api/client.ts b/frontend/app/api/client.ts index 6b7ce80..c26f1c6 100644 --- a/frontend/app/api/client.ts +++ b/frontend/app/api/client.ts @@ -3,11 +3,11 @@ import { createContext } from "react"; import { API_BASE_PATH } from "../config"; import type { paths } from "./schema"; +const apiOrigin = import.meta.env.VITE_API_BASE_URL + ?? (import.meta.env.DEV ? "http://localhost:8004" : ""); + const client = createClient<paths>({ - baseUrl: - process.env.NODE_ENV === "development" - ? `http://localhost:8004${API_BASE_PATH}` - : `https://t.nil.ninja${API_BASE_PATH}`, + baseUrl: `${apiOrigin}${API_BASE_PATH}`, }); export async function apiLogin(username: string, password: string) { |
