import http from '@/utils/request'
import { StrAnyObj } from '@/typings'

// 获取验证码
export const getCaptchaImageApi = () => {
  return http.get<StrAnyObj>(`/getCaptchaImage`, undefined, { loading: false })
}

// 登录
export const loginApi = (data: StrAnyObj) => {
  return http.post<StrAnyObj>(`/login`, data, { loading: false })
}

// 退出登录
export const logoutApi = () => {
  return http.post<void>(`/logout`)
}

// 获取登录信息
export const getLoginInfoApi = () => {
  return http.get<StrAnyObj>(`/getLoginInfo`)
}

// 获取用户信息
export const getUserInfoApi = () => {
  return http.get<StrAnyObj>(`/getUserInfo`)
}

// 修改用户信息
export const editUserInfoApi = (data: StrAnyObj) => {
  return http.post<void>(`/editUserInfo`, data)
}

// 修改用户密码
export const editPwdApi = (data: StrAnyObj) => {
  return http.post<void>(`/editPwd`, data)
}
