2026-03-15 21:08:51 +08:00

28 lines
669 B
Markdown
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

# jwt.ts
**路径**`src/api/jwt.ts`
## 功能用途
JWT 相关接口,用于退出登录时将当前 token 加入黑名单,使 token 失效。
## 核心能力
- `jsonInBlacklist`POST /jwt/jsonInBlacklist需鉴权x-token、x-user-id
## POST /jwt/jsonInBlacklist
### 请求
- 方法POST
- 鉴权:需在 headers 中传 x-token、x-user-id
- Body
### 响应
`{ code, msg }`,标准 ApiResponse。
### 使用场景
退出登录时由 `useUserStore().logout()` 调用,在清空本地 token 前先请求该接口,使服务端将当前 JWT 加入黑名单。若请求失败如网络错误、401仍会执行本地登出。