dwh 2 lat temu
rodzic
commit
940ff73b40
1 zmienionych plików z 31 dodań i 30 usunięć
  1. 31 30
      src/router/index.js

+ 31 - 30
src/router/index.js

@@ -7,19 +7,20 @@ VueRouter.prototype.push = function push(location) {
 Vue.use(VueRouter);
 
 const routes = [
-  {
-    path: "/login",
-    name: "login",
-	meta:{
-		keepAlive:true
-	},
-    component: ()=>import("../views/login/login.vue")
-  },
-  {
-    path: "/",
-    name: "test",
-    component: ()=>import("../views/test/test.vue")
-  },
+	{
+	    path: "/",
+	    name: "test",
+	    component: ()=>import("../views/test/test.vue")
+    },
+   {
+		path: "/login",
+		name: "login",
+		meta:{
+			keepAlive:true
+		},
+		component: ()=>import("../views/login/login.vue")
+   },
+  
   {
     path: "/loginByPhone",
     name: "loginByPhone",
@@ -254,22 +255,22 @@ const router = new VueRouter({
   base: process.env.BASE_URL,
   routes,
 });
-router.beforeEach((to,from,next)=>{
-	console.log(to,from)
-	if(to.name==='test'){
-		next();
-	}
-	if(!localStorage.getItem('user')){
-		if(to.name==='login'||(from.name==='login'&&to.name==='loginByPhone')||(from.name==='loginByPhone'&&to.name==='loginByCode')){
-			next();
-		}
-		else {
-			next({path:'/'});
-		}
-	}
-	else{
-		next();
-	}
+// router.beforeEach((to,from,next)=>{
+// 	console.log(to,from)
+// 	if(to.name==='test'){
+// 		next();
+// 	}
+// 	if(!localStorage.getItem('user')){
+// 		if(to.name==='login'||(from.name==='login'&&to.name==='loginByPhone')||(from.name==='loginByPhone'&&to.name==='loginByCode')){
+// 			next();
+// 		}
+// 		else {
+// 			next({path:'/'});
+// 		}
+// 	}
+// 	else{
+// 		next();
+// 	}
 	
-});
+// });
 export default router;