import { http } from './http'

export async function getCaptcha() {
  const { data } = await http.get('/api/auth/captcha')
  return data.data
}

export async function login(req) {
  const { data } = await http.post('/api/auth/login', req)
  return data.data
}

export async function register(req) {
  const { data } = await http.post('/api/auth/register', req)
  return data.data
}

export async function me() {
  const { data } = await http.get('/api/auth/me')
  return data.data
}

export async function updateProfile(data) {
  await http.post('/api/auth/profile', data)
}

export async function updatePassword(data) {
  await http.post('/api/auth/password', data)
}
