fix(deploy): vite config lazy load

This commit is contained in:
Ran
2026-02-14 22:16:55 +08:00
parent f964cbca69
commit 5c46d41ebf
5 changed files with 69 additions and 37 deletions
+5 -2
View File
@@ -6,8 +6,11 @@ import router from '@/router'
* Call this once at app startup (main.ts).
*/
export function setupApiClient() {
// Set base URL to match the Vite proxy
client.setConfig({ baseUrl: '/api' })
const apiBaseUrl = import.meta.env.VITE_API_URL?.trim() || '/api'
const agentBaseUrl = import.meta.env.VITE_AGENT_URL?.trim() || '/agent'
void agentBaseUrl
client.setConfig({ baseUrl: apiBaseUrl })
// Add auth token to every request
client.interceptors.request.use((request) => {