Files
exchange/resources/assets/js/middleware/auth.js
T
2018-05-19 12:01:26 +08:00

14 lines
263 B
JavaScript

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