refactor: 重命名 LoginResult 为 LoginResponse

- 重命名类型定义以符合 Request/Response 标准命名
- 删除 api/auth.ts 中的重复类型定义
- 统一使用 types/api 中的类型定义
- 提高代码一致性和可维护性
This commit is contained in:
Ray.Hao
2025-12-12 14:31:39 +08:00
parent 265f7b42e4
commit f125473b93
10 changed files with 2 additions and 38 deletions

View File

@@ -20,7 +20,7 @@ const AuthAPI = {
/** 刷新 token 接口*/
refreshToken(refreshToken: string) {
return request<any, LoginResult>({
return request<any, LoginResponse>({
url: `${AUTH_BASE_URL}/refresh-token`,
method: "post",
params: { refreshToken },
@@ -48,39 +48,3 @@ const AuthAPI = {
};
export default AuthAPI;
/** 登录请求参数 */
export interface LoginRequest {
/** 用户名 */
username: string;
/** 密码 */
password: string;
/** 验证码缓存ID */
captchaId?: string;
/** 验证码 */
captchaCode?: string;
/** 记住我(前端使用,不发送到后端) */
rememberMe?: boolean;
/** 租户ID可选多租户模式下用于指定租户 */
tenantId?: number;
}
/** 登录响应 */
export interface LoginResult {
/** 访问令牌 */
accessToken: string;
/** 刷新令牌 */
refreshToken: string;
/** 令牌类型 */
tokenType: string;
/** 过期时间(秒) */
expiresIn: number;
}
/** 验证码信息 */
export interface CaptchaInfo {
/** 验证码缓存ID */
captchaId: string;
/** 验证码图片Base64字符串 */
captchaBase64: string;
}