import request from '@/utils/request' import type { ApiResponse } from './types' export interface LoginParams { username: string password: string } export interface UserInfo { id: number username: string nickname: string avatar: string roles: string[] } export const userApi = { // 登录 login(data: LoginParams) { return request.post>('/auth/login', data) }, // 获取用户信息 getUserInfo() { return request.get>('/user/info') }, // 修改密码 changePassword(data: { oldPassword: string; newPassword: string }) { return request.post('/user/change-password', data) }, // 更新用户信息 updateUserInfo(data: Partial) { return request.put('/user/info', data) } }