// @ts-ignore
/* eslint-disable */
import {request} from 'umi';

export async function sendCaptcha(params: { phone?: string }) {
  return request('/api/v1/user/sendCaptcha', {
    method: 'POST',
    data: params,
    skipErrorHandler: true
  });
}


export async function sendEmailCaptcha(params: { email?: string }) {
  return request('/api/v1/user/sendEmailCaptcha', {
    method: 'POST',
    data: params,
    skipErrorHandler: true
  });
}

export async function login(params: API.LoginParams) {
  return request<API.Response<API.User>>('/api/v1/user/login', {
    method: 'POST',
    data: params,
    skipErrorHandler: true
  });
}

export async function register(params: API.RegisterParams) {
  return request<API.Response<API.User>>('/api/v1/user/register', {
    method: 'POST',
    data: params,
    skipErrorHandler: true
  });
}

export async function userInfo() {
  return request<API.Response<API.User>>('/api/v1/user/userInfo', {
    method: 'POST',
    skipErrorHandler: true
  });
}
