This commit is contained in:
2026-08-26 17:23:42 +08:00
parent 48d3c32293
commit 5ad9757dd5
5 changed files with 51 additions and 12 deletions
+4
View File
@@ -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
}