From c7d54db31abea7fec7bba066cbc9233a1a85624a Mon Sep 17 00:00:00 2001 From: tbphp Date: Wed, 2 Jul 2025 18:09:06 +0800 Subject: [PATCH] fix: API config --- web/src/utils/http.ts | 2 +- web/vite.config.ts | 3 +-- 2 files changed, 2 insertions(+), 3 deletions(-) diff --git a/web/src/utils/http.ts b/web/src/utils/http.ts index d75db53..8bfe8f2 100644 --- a/web/src/utils/http.ts +++ b/web/src/utils/http.ts @@ -1,7 +1,7 @@ import axios from "axios"; const http = axios.create({ - baseURL: import.meta.env.VITE_API_BASE_URL, + baseURL: "/api", timeout: 10000, headers: { "Content-Type": "application/json" }, }); diff --git a/web/vite.config.ts b/web/vite.config.ts index a227b07..a2ea92f 100644 --- a/web/vite.config.ts +++ b/web/vite.config.ts @@ -17,9 +17,8 @@ export default defineConfig({ // 代理配置示例 proxy: { "/api": { - target: "http://api.example.com", + target: "http://localhost:3000", changeOrigin: true, - rewrite: path => path.replace(/^\/api/, ""), }, }, },