优化
This commit is contained in:
+3
-3
@@ -45,12 +45,12 @@ function overseasUrl(path) {
|
||||
const nativeRuntime = typeof plus !== 'undefined'
|
||||
|| (typeof location !== 'undefined' && location.protocol === 'file:')
|
||||
if (nativeRuntime && !/^https?:\/\//i.test(base)) {
|
||||
const error = new Error('海外服务地址未配置:App 必须设置绝对 HTTP(S) 地址 VITE_OVERSEAS_API_BASE_URL')
|
||||
error.code = 'PDA_OVERSEAS_API_BASE_REQUIRED'
|
||||
const error = new Error('海外服务地址未配置:App 必须设置绝对 HTTP(S) 地址 VITE_API_BASE_URL')
|
||||
error.code = 'PDA_API_BASE_REQUIRED'
|
||||
throw error
|
||||
}
|
||||
const value = `/${String(path || '').replace(/^\/+/, '')}`
|
||||
const normalized = /\/(?:api|overseas-api)$/.test(base)
|
||||
const normalized = /\/api$/.test(base)
|
||||
? value.replace(/^\/api(?=\/)/, '')
|
||||
: value
|
||||
return `${base}${normalized}`
|
||||
|
||||
Reference in New Issue
Block a user