import { startApp } from "./App";
import router from "./router";

import { initAuth } from "@queenjs-modules/auth";
import { Dict_Apis } from "@/dict/apis";

function initLocalAuth() {

    //获取token
    const params = new URLSearchParams(decodeURIComponent(location.search))
    const token =  params.get("token") as string;
    if (token) {
    localStorage.setItem("token", JSON.stringify(token))
    }
    const auth = initAuth({
        config: {
        httpConfig: {
            baseURL: Dict_Apis.authLocal,
        },
        key: "queentreesku3d",
        loginPath: "/login",
        loginJumpPath: "/",
        logoutJumpPath: "/login",

        needCompanyLogin: false,
        needRegister: true,
        needResetPwd: true,
        },
    });
  auth.actions.initUser();
}

startApp(router, [initLocalAuth]);
