This commit is contained in:
Kamil Klecha
2021-06-01 22:56:36 +02:00
parent d39e9f15e6
commit 3320858efa
20 changed files with 13959 additions and 1 deletions

42
src/router/index.js Normal file
View File

@@ -0,0 +1,42 @@
import Vue from 'vue'
import VueRouter from 'vue-router'
import Index from '../components/Index.vue'
import store from '../store/index'
Vue.use(VueRouter)
const routes = [
{
path: '/login',
name: 'Index',
component: Index
},
{
path: '/list',
name: 'List',
component: () => import(/* webpackChunkName: "List" */ '../components/List.vue'),
beforeEnter: (to, from, next) => {
if(store.getters.isUserAuthenticated) {
next();
}
else {
next('/login');
}
}
},
{ path: '*', redirect: '/login' }
// {
// path: '/about',
// name: 'About',
// // route level code-splitting
// // this generates a separate chunk (about.[hash].js) for this route
// // which is lazy-loaded when the route is visited.
// component: () => import(/* webpackChunkName: "about" */ '../views/About.vue')
// }
]
const router = new VueRouter({
routes
})
export default router