diff --git a/.env.development b/.env.development new file mode 100644 index 00000000..b27eade5 --- /dev/null +++ b/.env.development @@ -0,0 +1 @@ +VITE_API_BASE_URL=http://localhost:3001/api/v1/ diff --git a/.env.production b/.env.production new file mode 100644 index 00000000..7fcf8e0c --- /dev/null +++ b/.env.production @@ -0,0 +1 @@ +VITE_API_BASE_URL=/api/v1/ diff --git a/src/api/index.ts b/src/api/index.ts index 2dab65cf..6da16f46 100644 --- a/src/api/index.ts +++ b/src/api/index.ts @@ -4,7 +4,7 @@ import axios from 'axios' // 创建axios实例 const api = axios.create({ - baseURL: '/api/v1/', + baseURL: import.meta.env.VITE_API_BASE_URL, }) // 添加请求拦截器