Newer
Older
gdtMimiProgram / api / user.js
dutingting on 22 Nov 2022 883 bytes 处理冲突
import fetch from "@/common/fetch.js";
import BASE_URL from "./base.js";
import useNetWork from "@/common/useNetWork.js";
const LOGIN = BASE_URL + "/user/getLoginToken";
const UserType = BASE_URL + "/user/getUserType";
const UserRegister = BASE_URL + "/user/userRegister";
const UpdateUserImg = BASE_URL + "/user/updateUserImg";

export function login(code) {
  useNetWork();
  const params = `${LOGIN}?code=${code}`;
  return fetch.get(params).then((res) => res);
}

/**
 * 获取到用户类型
 * @param {*}
 */
export function getUserType() {
  useNetWork();
  return fetch.get(UserType).then((res) => res);
}

/**
 * 注册
 * @param {*}
 */
export function getUserRegister(data) {
  useNetWork();
  const params = {
    phone: data.phone,
    account: data.account,
    name: data.name,
    salt: data.salt,
  };
  return fetch.post(UserRegister, params).then((res) => res);
}