This commit is contained in:
2018-11-05 21:35:34 +00:00
parent 0663712235
commit a198bfcfb9
4 changed files with 212 additions and 126 deletions

View File

@@ -43,3 +43,35 @@ export default new Router({
}
]
});
// router.beforeEach((to, from, next) => {
// if(to.matched.some(record => record.meta.requiresAuth)) {
// if (localStorage.getItem('jwt') == null) {
// next({
// path: '/login',
// params: { nextUrl: to.fullPath }
// })
// } else {
// let user = JSON.parse(localStorage.getItem('user'))
// if(to.matched.some(record => record.meta.is_admin)) {
// if(user.is_admin == 1){
// next()
// }
// else{
// next({ name: 'userboard'})
// }
// }else {
// next()
// }
// }
// } else if(to.matched.some(record => record.meta.guest)) {
// if(localStorage.getItem('jwt') == null){
// next()
// }
// else{
// next({ name: 'userboard'})
// }
// }else {
// next()
// }
// })