fix(api): 修复登录用户信息接口类型定义

- 更新fetchLoginUserInfo返回类型为UserInfoResponse
- 添加UserInfoResponse接口定义,匹配后端实际返回结构
- 在User实体中添加userId字段支持后端字段映射
- 确保类型安全和前后端数据结构一致性
This commit is contained in:
Leo 2025-07-06 22:10:17 +08:00
parent 2c5e2234d8
commit 5d79b0085d
3 changed files with 17 additions and 1 deletions

View File

@ -60,7 +60,7 @@ export function fetchUserRoutesOld(params: { id: number }) {
} }
export function fetchLoginUserInfo() { export function fetchLoginUserInfo() {
return request.Get<Service.ResponseResult<Api.Login.Info>>('/coder/sysLoginUser/getLoginUserInformation') return request.Get<Service.ResponseResult<Api.Login.UserInfoResponse>>('/coder/sysLoginUser/getLoginUserInformation')
} }
// 验证码相关接口 // 验证码相关接口

View File

@ -13,5 +13,19 @@ namespace Api {
/** 访问token */ /** 访问token */
refreshToken: string refreshToken: string
} }
/* 获取登录用户信息接口返回的数据结构 */
interface UserInfoResponse {
/** 登录用户基本信息 */
loginUser: {
userId: number
userName: string
avatar?: string
}
/** 用户角色列表 */
roles: string[]
/** 用户权限按钮列表 */
buttons: string[]
}
} }
} }

View File

@ -5,6 +5,8 @@ namespace Entity {
interface User { interface User {
/** 用户id */ /** 用户id */
id?: number id?: number
/** 用户id (后端字段) */
userId?: number
/** 用户名 */ /** 用户名 */
userName?: string userName?: string
/* 用户头像 */ /* 用户头像 */