From 8b454eced8472593015d6ed765f3c7148d32400f Mon Sep 17 00:00:00 2001 From: Jeffrey Hsu Date: Sat, 5 Oct 2024 21:05:56 +0800 Subject: [PATCH] =?UTF-8?q?=E6=B7=BB=E5=8A=A0=E7=8E=AF=E5=A2=83=E5=8F=98?= =?UTF-8?q?=E9=87=8F?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .env.development | 1 + .env.production | 1 + src/utils/network.ts | 2 +- 3 files changed, 3 insertions(+), 1 deletion(-) create mode 100644 .env.development create mode 100644 .env.production diff --git a/.env.development b/.env.development new file mode 100644 index 0000000..04bd733 --- /dev/null +++ b/.env.development @@ -0,0 +1 @@ +VITE_BASE_URL = "/api" \ No newline at end of file diff --git a/.env.production b/.env.production new file mode 100644 index 0000000..56ffd93 --- /dev/null +++ b/.env.production @@ -0,0 +1 @@ +VITE_BASE_URL = "/" \ No newline at end of file diff --git a/src/utils/network.ts b/src/utils/network.ts index 39f99a2..ce6e7c5 100644 --- a/src/utils/network.ts +++ b/src/utils/network.ts @@ -2,7 +2,7 @@ import axios, {AxiosError, AxiosRequestConfig} from 'axios' export async function request(config: AxiosRequestConfig): Promise { const instance = axios.create({ - baseURL: "/api", + baseURL: import.meta.env.VITE_BASE_URL, timeout: 5000, headers: {}, })