From 6325b84ca0fb668ac365c53bf56536e155e35244 Mon Sep 17 00:00:00 2001 From: zhilv Date: Sat, 28 Mar 2026 18:01:39 +0800 Subject: [PATCH] =?UTF-8?q?feat:=20=E6=B7=BB=E5=8A=A0=E7=94=9F=E4=BA=A7?= =?UTF-8?q?=E7=8E=AF=E5=A2=83=E4=B8=8E=E5=BC=80=E5=8F=91=E7=8E=AF=E5=A2=83?= =?UTF-8?q?=E9=85=8D=E7=BD=AE?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .env.development | 1 + .env.production | 1 + env.d.ts | 9 +++++++++ src/service/http.ts | 2 +- 4 files changed, 12 insertions(+), 1 deletion(-) create mode 100644 .env.development create mode 100644 .env.production create mode 100644 env.d.ts diff --git a/.env.development b/.env.development new file mode 100644 index 0000000..804ba9b --- /dev/null +++ b/.env.development @@ -0,0 +1 @@ +VITE_BASE_URL="http://localhost:8080" \ No newline at end of file diff --git a/.env.production b/.env.production new file mode 100644 index 0000000..967069d --- /dev/null +++ b/.env.production @@ -0,0 +1 @@ +VITE_BASE_URL="http://local.kmux.cn:8080" \ No newline at end of file diff --git a/env.d.ts b/env.d.ts new file mode 100644 index 0000000..72eb128 --- /dev/null +++ b/env.d.ts @@ -0,0 +1,9 @@ +/// + +interface ImportMetaEnv { + readonly VITE_BASE_URL: string; +} + +interface ImportMeta { + readonly env: ImportMetaEnv; +} diff --git a/src/service/http.ts b/src/service/http.ts index 89ddd09..b7f2ee2 100644 --- a/src/service/http.ts +++ b/src/service/http.ts @@ -22,7 +22,7 @@ export const createHttpClient = ( resolveSessionId?: SessionResolver, ): HttpClient => { const instance = axios.create({ - baseURL: "http://local.kmux.cn:8080", + baseURL: import.meta.env.VITE_BASE_URL, }); instance.interceptors.request.use((config: InternalAxiosRequestConfig) => {