opnform-host-nginx/client/middleware/admin.js

8 lines
229 B
JavaScript
Raw Normal View History

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