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) => {