import store from "../store";
// import { getUserInfo } from "@/api/index";
import { terminalType } from "@/utils/index";
// import router from "@/router/index";

export async function userLogin() {
  localStorage.removeItem("token");
  localStorage.removeItem("userInfo");
  store.commit("setToken", "");
  store.commit("setUserInfo", "");

  const ua = navigator.userAgent.toLowerCase();
  const isWeixin = ua.indexOf("micromessenger") !== -1;
  console.log(isWeixin, terminalType);
  // console.log("router", router);
  location.href = `${
    window.config.loginUrl
  }?needWx=false&redirect=${encodeURIComponent(location.href)}`;
}
