crator and messageResponse

This commit is contained in:
saeid
2019-04-24 21:20:12 +04:30
parent df660dd7d4
commit fc162db99b
29 changed files with 460 additions and 817 deletions
+6 -4
View File
@@ -52,12 +52,14 @@ const router = new Router({
Vue.use(Meta)
import {$hasRole} from '@/services/acl/role';
router.beforeEach((to, from, next) => {
const isPublic = to.matched.some(record => record.meta.public);
const onlyWhenLoggedOut = to.matched.some(record => record.meta.onlyWhenLoggedOut);
const loggedIn = !!TokenService.getToken();
const roles = to.matched.some(record => record.meta.roles);
const roles = (to.meta && to.meta.roles) ? to.meta.roles : null;
if (!isPublic && !loggedIn) {
return next({
path:'/login',
@@ -71,9 +73,9 @@ router.beforeEach((to, from, next) => {
}
// Do not allow user to visit Pages then not access roles
// if (roles && !$hasRole(roles)) {
// return next('/')
// }
if (roles && !$hasRole(roles)) {
return next('/')
}
next();
});