import { get, post } from '@/utils/request'
import type { IBaseResponse, BaseResponse, LoginParams, LoginResponse, AdminInfo, ChangePasswordRequest } from '@/types'

// 登录
export function login(data: LoginParams): Promise<IBaseResponse<LoginResponse>> {
  return post('/admin/auth/login', data)
}

// 获取当前用户信息
export function getInfo(): Promise<IBaseResponse<AdminInfo>> {
  return get('/admin/auth/info')
}

// 退出登录
export function logout(): Promise<BaseResponse> {
  return post('/admin/auth/logout')
}

// 修改密码
export function changePassword(data: ChangePasswordRequest): Promise<BaseResponse> {
  return post('/admin/auth/password', data)
}
