fix(auth): 修复令牌过期处理和会话失效通知机制

- 移除 VITE_SERVICE_LOGOUT_CODES 中的 1002023000 状态码
- 将 VITE_SERVICE_EXPIRED_TOKEN_CODES 从 1002023001 改为 1002023000
- 修改 fetchRefreshToken 函数使用 params 传递 refreshToken 并设置 skipAuth
- 添加 skipAuth 配置选项避免给公开接口带上过期 access 头
- 实现 notifySessionExpired 函数确保并发请求只弹一次会话失效提示
- 在登录成功后复位会话失效标志以支持下次正常提示
- 更新 handleExpiredRequest 使用 refreshTokenPromise 替代 refreshTokenFn
This commit is contained in:
2026-05-15 13:38:41 +08:00
parent 7a4d831c10
commit 543d1a59a9
7 changed files with 69 additions and 19 deletions

View File

@@ -3,6 +3,13 @@ import type { InternalAxiosRequestConfig } from 'axios';
declare module 'axios' {
interface AxiosRequestConfig {
dedupe?: boolean;
/**
* 跳过 Authorization 注入。
*
* 用于公开接口refresh-token / login / register 等 PermitAll 路径),
* 避免给它们带上过期 access 头被网关拦截。
*/
skipAuth?: boolean;
}
}