opnform/resources/js/middleware/admin.js

11 lines
207 B
JavaScript
Raw Normal View History

import { useAuthStore } from '../stores/auth';
2022-09-20 19:59:52 +00:00
export default (to, from, next) => {
const authStore = useAuthStore()
if (!authStore.user?.admin) {
2022-09-20 19:59:52 +00:00
next({ name: 'home' })
} else {
next()
}
}