|
@@ -9,21 +9,21 @@ import axios from 'axios'
|
|
|
*/
|
|
*/
|
|
|
function resolveBaseURL(): string {
|
|
function resolveBaseURL(): string {
|
|
|
if (import.meta.env.VITE_FORCE_LOCAL === 'true') {
|
|
if (import.meta.env.VITE_FORCE_LOCAL === 'true') {
|
|
|
- console.log('[baseURL] VITE_FORCE_LOCAL=true, 强制走本地 proxy /videoVector')
|
|
|
|
|
|
|
+ if (import.meta.env.DEV) console.log('[baseURL] VITE_FORCE_LOCAL=true, 强制走本地 proxy /videoVector')
|
|
|
return '/videoVector'
|
|
return '/videoVector'
|
|
|
}
|
|
}
|
|
|
const urlApiBase = new URLSearchParams(window.location.search).get('apiBase')
|
|
const urlApiBase = new URLSearchParams(window.location.search).get('apiBase')
|
|
|
if (urlApiBase) {
|
|
if (urlApiBase) {
|
|
|
- console.log('[baseURL] 使用 URL 参数 apiBase:', urlApiBase)
|
|
|
|
|
|
|
+ if (import.meta.env.DEV) console.log('[baseURL] 使用 URL 参数 apiBase:', urlApiBase)
|
|
|
return urlApiBase
|
|
return urlApiBase
|
|
|
}
|
|
}
|
|
|
const fallback = import.meta.env.VITE_API_BASE_URL ?? '/videoVector'
|
|
const fallback = import.meta.env.VITE_API_BASE_URL ?? '/videoVector'
|
|
|
- console.log('[baseURL] 使用兜底值:', fallback)
|
|
|
|
|
|
|
+ if (import.meta.env.DEV) console.log('[baseURL] 使用兜底值:', fallback)
|
|
|
return fallback
|
|
return fallback
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
const baseURL = resolveBaseURL()
|
|
const baseURL = resolveBaseURL()
|
|
|
-console.log('[baseURL] 最终 baseURL:', baseURL, '| DEV:', import.meta.env.DEV, '| VITE_FORCE_LOCAL:', import.meta.env.VITE_FORCE_LOCAL)
|
|
|
|
|
|
|
+if (import.meta.env.DEV) console.log('[baseURL] 最终 baseURL:', baseURL)
|
|
|
|
|
|
|
|
const client = axios.create({
|
|
const client = axios.create({
|
|
|
baseURL,
|
|
baseURL,
|