12345678910111213141516171819202122232425 |
- import router from "./router";
- import { getCookie, removeToken } from "@/utills/auth"; // getToken from cookie
- import { Base64 } from "js-base64";
- const whiteList = ["/integratedAlarm", "/login", "/logout"]; // 不重定向白名单
- import store from "@/store";
- router.beforeEach((to, from, next) => {
- if (to.path == "/login" || to.path == "/") {
- next({ path: "/integratedAlarm" });
- } else {
- next();
- }
- // if (getCookie("authToken")) {
- // if (to.path == "/login" || to.path == "/") {
- // next({ path: "/integratedAlarm" });
- // } else {
- // next();
- // }
- // } else if (whiteList.indexOf(to.path) !== -1) {
- // next();
- // } else {
- // next(`/login?redirect=${to.fullPath}`);
- // }
- });
- router.afterEach((to, from, next) => { });
|