import { getSystemInfo } from "../../utils";
import request from "../../http/request";

export const authBaseApi = "/auth";
/**
 * 发送验证码
 * @param params {mobile: string,code: string}
 * @returns
 */
export const sendCodeApi = (params) => {
  return request({
    url: `${authBaseApi}/send_code`,
    method: "POST",
    data: params,
  });
};

/**
 * 发送修改密码验证码
 * @param params {mobile: string}
 * @returns
 */
export const sendChangePasswordCodeApi = (params) => {
  let os = getSystemInfo();
  return request({
    url: `${authBaseApi}/send-change-password-code`,
    method: "POST",
    data: { os, ...params },
  });
};

/**
 * 修改密码
 * @param params
 * @returns
 */
export const changePasswordApi = (params) => {
  let os = getSystemInfo();
  return request({
    url: `${authBaseApi}/change-password`,
    method: "POST",
    data: { os, ...params },
  });
};

/**
 * 短信登录
 */
export const smsLoginApi = (params) => {
  const os = getSystemInfo();
  return request({
    url: `${authBaseApi}/sms_login`,
    method: "POST",
    data: { os, ...params },
  });
};
