优化
This commit is contained in:
@@ -54,6 +54,7 @@ function rawRequest(method, path, data, token) {
|
||||
}
|
||||
|
||||
export async function overseasRequest(method, path, data, retry = true) {
|
||||
console.info('[Overseas PDA API] request', { method, path })
|
||||
const attemptedToken = session.token
|
||||
let response = await rawRequest(method, path, data, attemptedToken)
|
||||
if (retry && unauthorized(response)) {
|
||||
@@ -61,6 +62,9 @@ export async function overseasRequest(method, path, data, retry = true) {
|
||||
response = await rawRequest(method, path, data, replacementToken)
|
||||
}
|
||||
const body = response?.data || {}
|
||||
console.info('[Overseas PDA API] response', { method, path, statusCode: response?.statusCode, code: body?.code,
|
||||
message: body?.message, requestId: body?.requestId || response?.header?.['x-request-id'] || response?.header?.['X-Request-Id'],
|
||||
traceId: body?.traceId || response?.header?.['x-trace-id'] || response?.header?.['X-Trace-Id'] })
|
||||
if (!successful(response, body)) throw errorFrom(response, '海外作业请求失败')
|
||||
return body.data
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user