Files
exchange/resources/assets/js/middleware/auth.js
T
2018-06-21 16:35:09 +08:00

12 lines
253 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/role'] == 'admin') {
next({ name: 'admin.home' })
} else {
next()
}
}