import request from '@/utils/request'

// 登录方法
export function login(mobile, password, code) {
  const data = {
    mobile,
    password,
    code
  }
  return request({
    url: '/member/auth/login',
    headers: {
      isToken: false,
      repeatSubmit: false
    },
    method: 'post',
    data: data
  })
}

// 注册方法
export function register(data) {
  return request({
    url: '/register',
    headers: {
      isToken: false
    },
    method: 'post',
    data: data
  })
}

// 获取用户详细信息
export function getInfo() {
  return request({
    url: '/member/user/get',
    method: 'get'
  })
}

// 退出方法
export function logout() {
  return request({
    url: '/member/auth/logout',
    method: 'post'
  })
}

// 发送验证码
export function sendCode(data) {
  return request({
    url: '/member/auth/send-sms-code',
    method: 'post',
    data: data
  })
}

// 验证码提交
export function submitCode(data) {
  return request({
    url: '/member/auth/sms-login',
    method: 'post',
    data: data
  })
}
