Allowance check
This commit is contained in:
Vendored
+14
@@ -18,6 +18,20 @@ const router = new VueRouter({
|
||||
routes
|
||||
});
|
||||
|
||||
router.beforeEach(function (to, from, next) {
|
||||
if (!to.path.startsWith('/admin') || to.name === 'Admin Login') {
|
||||
return next();
|
||||
}
|
||||
if (!localStorage.getItem('Access Token')) {
|
||||
return next();
|
||||
}
|
||||
var role = localStorage.getItem('admin_role');
|
||||
if (role === '3' && to.name !== 'Kehadiran Calon') {
|
||||
return next({ name: 'Kehadiran Calon', replace: true });
|
||||
}
|
||||
next();
|
||||
});
|
||||
|
||||
const app = new Vue({
|
||||
router
|
||||
}).$mount('#app');
|
||||
|
||||
Reference in New Issue
Block a user