[高] 前端401拦截器绕过Pinia Store直接操作localStorage #76

Closed
opened 2026-05-10 18:39:09 +08:00 by admin · 0 comments
Owner

问题描述

frontend/src/api/index.ts 第53-56行和第83行,401响应拦截器直接清除 localStorage 中的 token,但不通过 Pinia Store 清除。Pinia Store 中仍保留旧 token,导致状态不一致。

涉及文件

  • frontend/src/api/index.ts:53-56, 83
  • frontend/src/stores/user.ts

修复建议

401拦截器应调用 useUserStore().logout() 统一处理,而非直接操作 localStorage。

严重程度

高 - 认证状态不一致

## 问题描述 frontend/src/api/index.ts 第53-56行和第83行,401响应拦截器直接清除 localStorage 中的 token,但不通过 Pinia Store 清除。Pinia Store 中仍保留旧 token,导致状态不一致。 ## 涉及文件 - frontend/src/api/index.ts:53-56, 83 - frontend/src/stores/user.ts ## 修复建议 401拦截器应调用 useUserStore().logout() 统一处理,而非直接操作 localStorage。 ## 严重程度 高 - 认证状态不一致
admin closed this issue 2026-05-10 18:59:09 +08:00
Sign in to join this conversation.
No Label
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: admin/aiagent#76