opnform/client/middleware/admin.js

9 lines
229 B
JavaScript
Raw Normal View History

2023-12-14 15:53:05 +00:00
import {useAuthStore} from "../../resources/js/stores/auth.js";
export default defineNuxtRouteMiddleware((to, from) => {
const authStore = useAuthStore()
if (!authStore.user?.admin) {
navigateTo({ name: 'home' })
}
})