export default defineNuxtRouteMiddleware(async (to, from) => { const accountStore = useAccountStore(); if (!accountStore.valid) { console.log("Not logged in, redirecting to /login"); return navigateTo("/login"); } if ( to.meta.allowedAccountTypes && !to.meta.allowedAccountTypes.includes(accountStore.type!) ) { throw createError({ status: 403, statusMessage: "Forbidden", message: "You are not allowed to access this resource.", }) } })