import { http } from './client'
import type { User } from '@/types'

export const userApi = {
  /**
   * 获取当前用户信息
   */
  async getProfile() {
    return http.get<User>('/user/profile')
  },

  /**
   * 更新用户信息
   */
  async updateProfile(data: { userName?: string; avatar?: string }) {
    return http.put<User>('/user/profile', data)
  },

  /**
   * 修改密码
   */
  async changePassword(oldPassword: string, newPassword: string) {
    return http.put('/user/password', { oldPassword, newPassword })
  }
}

