opnform/resources/js/middleware/admin.js

10 lines
164 B
JavaScript

import store from '~/store'
export default (to, from, next) => {
if (!store.getters['auth/user'].admin) {
next({ name: 'home' })
} else {
next()
}
}