import request from '@/utils/request'

const api = {
  register: '/User/Register',
  Login: '/User/Login',
  ImgCaptcha: '/Captcha/ImageCaptcha',
  GetPermissions: '/User/GetPermissions',
  sendEmail: '/Captcha/SendEmail',
  UniLoginOptions: '/UniLogin/Options',
  GetLoginUrl: '/UniLogin/GetLoginUrl',
  UniLogin: '/UniLogin/Login',
  BindSocial: '/UniLogin/BindSocial',
  UnbindSocial: '/UniLogin/UnbindSocial'
}

export function register(parameter) {
  return request({
    url: api.register,
    method: 'post',
    data: parameter
  })
}

export function login (parameter) {
  return request({
    url: api.Login,
    method: 'post',
    data: parameter
  })
}

export function sendEmail(parameter) {
  return request({
    url: api.sendEmail,
    method: 'post',
    data: parameter
  })
}

export function getImageCaptcha () {
  return request({
    url: api.ImgCaptcha,
    method: 'get'
  })
}

export function GetPermissions(parameter) {
  return request({
    url: api.GetPermissions,
    method: 'get',
    params: parameter
  })
}

export function getLoginUrl(parameter) {
  return request({
    url: api.GetLoginUrl,
    method: 'get',
    params: parameter
  })
}

export function getUniLoginOptions() {
  return request({
    url: api.UniLoginOptions,
    method: 'get'
  })
}

export function uniLogin(parameter) {
  return request({
    url: api.UniLogin,
    method: 'post',
    data: parameter
  })
}

export function bindSocial(parameter) {
  return request({
    url: api.BindSocial,
    method: 'post',
    data: parameter
  })
}

export function unbindSocial(parameter) {
  return request({
    url: api.UnbindSocial,
    method: 'post',
    data: parameter
  })
}
