From fa1f075c0ade1e34a20ceb9799b9655d8d337cf5 Mon Sep 17 00:00:00 2001 From: Sisyphus Date: Sat, 11 Jul 2026 09:27:50 +0800 Subject: [PATCH] =?UTF-8?q?fix(merge):=20=E9=97=AA=E9=80=80=E4=BF=AE?= =?UTF-8?q?=E5=A4=8D=20-=20=E4=B8=9A=E5=8A=A1=E7=BA=A7=20code:401=20?= =?UTF-8?q?=E4=B8=8D=E5=86=8D=E6=B8=85=20token=20=E8=B7=B3=E7=99=BB?= =?UTF-8?q?=E5=BD=95=20(=E4=BB=85=20HTTP=20401=20=E6=89=8D=E8=B7=B3)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/utils/request.ts | 9 +++------ 1 file changed, 3 insertions(+), 6 deletions(-) diff --git a/src/utils/request.ts b/src/utils/request.ts index 05a85e5..a266529 100644 --- a/src/utils/request.ts +++ b/src/utils/request.ts @@ -39,12 +39,9 @@ http.interceptors.response.use( const body = response.data as ApiEnvelope | undefined if (body && typeof body === 'object' && 'code' in body) { if (body.code === 0) return response - // 业务错:401 token 过期 / 其它业务错 - if (body.code === 401 || body.code === 401000) { - handleAuthExpired() - return Promise.reject(body) - } - // 业务错(不弹 toast,留给调用方决定) + // 业务级 code:401 (如 /openapi/** 带 token 时 Spring Security 返未授权) + // 不清 token 不跳登录,只 reject 给调用方处理 + // 真正的 token 过期走 error 拦截器 (HTTP status 401) return Promise.reject(body) } return response