This commit is contained in:
2026-08-26 15:24:51 +08:00
parent 312519f1ab
commit ee83d87a85
8 changed files with 53 additions and 12 deletions
+11 -2
View File
@@ -3,8 +3,17 @@ const configuredAuthApiRoot = runtimeEnvironment.VITE_AUTH_API_BASE_URL || ''
const configuredOverseasApiRoot = runtimeEnvironment.VITE_OVERSEAS_API_BASE_URL || ''
const development = Boolean(runtimeEnvironment.DEV)
export const API_ROOT = String(configuredAuthApiRoot || '/api').replace(/\/$/, '')
export const OVERSEAS_API_ROOT = String(configuredOverseasApiRoot || '/api/overseas').replace(/\/$/, '')
let selectedAuthApiRoot = configuredAuthApiRoot || '/api'
let selectedOverseasApiRoot = configuredOverseasApiRoot || '/overseas-api'
// H5 must stay same-origin and use Vite's CORS-safe proxy; App builds keep the absolute API roots above.
// #ifdef H5
selectedAuthApiRoot = runtimeEnvironment.VITE_H5_AUTH_API_BASE_URL || '/api'
selectedOverseasApiRoot = runtimeEnvironment.VITE_H5_OVERSEAS_API_BASE_URL || '/overseas-api'
// #endif
export const API_ROOT = String(selectedAuthApiRoot).replace(/\/$/, '')
export const OVERSEAS_API_ROOT = String(selectedOverseasApiRoot).replace(/\/$/, '')
export const DEV_LOGIN = Object.freeze({
username: development ? String(runtimeEnvironment.VITE_PDA_DEV_USERNAME || '') : '',
password: development ? String(runtimeEnvironment.VITE_PDA_DEV_PASSWORD || '') : ''