opnform/client/middleware/admin.js

7 lines
190 B
JavaScript
Raw Normal View History

2023-12-14 15:53:05 +00:00
export default defineNuxtRouteMiddleware((to, from) => {
const authStore = useAuthStore()
2023-12-16 18:21:03 +00:00
if (authStore.check && !authStore.user?.admin) {
return navigateTo({ name: 'home' })
2023-12-14 15:53:05 +00:00
}
})