16 lines
346 B
TypeScript
16 lines
346 B
TypeScript
export default defineNuxtRouteMiddleware(async (to) => {
|
|
const auth = useAuthStore()
|
|
if (!auth.isAuthenticated) {
|
|
return
|
|
}
|
|
|
|
const { loaded, loadSidebar, isRouteDisabled } = useSidebar()
|
|
if (!loaded.value) {
|
|
await loadSidebar()
|
|
}
|
|
|
|
if (isRouteDisabled(to.path)) {
|
|
return navigateTo('/')
|
|
}
|
|
})
|