fix(merge): 闪退修复 - 业务级 code:401 不再清 token 跳登录 (仅 HTTP 401 才跳)
This commit is contained in:
parent
cf00136340
commit
fa1f075c0a
@ -39,12 +39,9 @@ http.interceptors.response.use(
|
|||||||
const body = response.data as ApiEnvelope | undefined
|
const body = response.data as ApiEnvelope | undefined
|
||||||
if (body && typeof body === 'object' && 'code' in body) {
|
if (body && typeof body === 'object' && 'code' in body) {
|
||||||
if (body.code === 0) return response
|
if (body.code === 0) return response
|
||||||
// 业务错:401 token 过期 / 其它业务错
|
// 业务级 code:401 (如 /openapi/** 带 token 时 Spring Security 返未授权)
|
||||||
if (body.code === 401 || body.code === 401000) {
|
// 不清 token 不跳登录,只 reject 给调用方处理
|
||||||
handleAuthExpired()
|
// 真正的 token 过期走 error 拦截器 (HTTP status 401)
|
||||||
return Promise.reject(body)
|
|
||||||
}
|
|
||||||
// 业务错(不弹 toast,留给调用方决定)
|
|
||||||
return Promise.reject(body)
|
return Promise.reject(body)
|
||||||
}
|
}
|
||||||
return response
|
return response
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user