feat: 添加 token 刷新功能及相关类型定义

- 在 typings.d.ts 中新增 IUserToken 接口
- 在 login.ts 中添加 refreshToken 函数以支持 token 刷新
- 在 types/login.ts 中新增 IUserTokenVo 接口
- 更新 http.ts 以处理 token 刷新逻辑
- 修改 interceptor.ts 以使用新的 token 类型
- 在 user.ts 中整合 token 状态管理
This commit is contained in:
Hygge
2025-08-21 15:49:14 +08:00
parent 6900afa253
commit d9e16baca9
7 changed files with 136 additions and 12 deletions

View File

@@ -48,7 +48,7 @@ const httpInterceptor = {
}
// 3. 添加 token 请求头标识
const userStore = useUserStore()
const { token } = userStore.userInfo as unknown as IUserInfo
const { token } = userStore.userToken as unknown as IUserToken
if (token) {
options.header.Authorization = `Bearer ${token}`
}