From 51c2a65ad13f96389997bff8c4db937f42a3b9b3 Mon Sep 17 00:00:00 2001 From: nsfisis Date: Fri, 13 Feb 2026 22:46:05 +0900 Subject: refactor(frontend): replace process.env with import.meta.env in API client MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit BFF前提のURL分岐をVite SPA向けに調整。本番URLのハードコードを VITE_API_BASE_URL環境変数に外出し。 Co-Authored-By: Claude Opus 4.6 --- frontend/app/api/client.ts | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) (limited to 'frontend/app/api') 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({ - 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) { -- cgit v1.3.1