[高] 前端401拦截器绕过Pinia Store直接操作localStorage #76
Reference in New Issue
Block a user
Delete Branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
问题描述
frontend/src/api/index.ts 第53-56行和第83行,401响应拦截器直接清除 localStorage 中的 token,但不通过 Pinia Store 清除。Pinia Store 中仍保留旧 token,导致状态不一致。
涉及文件
修复建议
401拦截器应调用 useUserStore().logout() 统一处理,而非直接操作 localStorage。
严重程度
高 - 认证状态不一致