import {Auth} from './auth';
export default ({
Vue, // the version of Vue being used in the VuePress app
options, // the options for the root Vue instance
router, // the router instance for the app
siteData, // site metadata
}) => {
let auth = new Auth({
'admin': {
'allow': '*'
},
'cfo': {
'allow': '*'
},
'account': {
'allow': '*'
},
'head': {
'allow': [
'/main',
'/employees',
'/users'
]
},
'user': {
'allow': [
'/main'
]
},
'content': {
'allow': [
'/main',
'/content'
]
}
});
router.beforeEach((to, from, next) => {
if (! auth.canSee(to.path) && from.path !== '/'){
location.href = location.origin + '/auth';
}
next();
});
}
костыль примерно такого характера