import router from "./router";
import store from "./store";
import  isLogin  from "@/api/login";

const loginWhiteList = ["/", "/login", "/privacy", "/forgetPassword", "/userAgreement","/nopassword","/forget","/register","/setname",'/join','/createorg']; // 登录验证白名单

router.beforeEach((to, from, next) => {
  // 线上注释
  //   next()
  //   return
  if (store.getters.user.admin == null) {
    if (loginWhiteList.indexOf(to.path) !== -1) {
      next();
    } else {
      next({ path: "/" });
    }
  } else {
    next();
  }
});
