Files
Inventory/app/middleware/profile.global.ts
2025-09-17 23:11:13 +02:00

13 lines
342 B
TypeScript

import { useProfileSession } from '#imports'
export default defineNuxtRouteMiddleware(async (to) => {
const { ensureSession, activeProfile } = useProfileSession()
await ensureSession()
const isProfilesRoute = to.path.startsWith('/profiles')
if (!activeProfile.value && !isProfilesRoute) {
return navigateTo('/profiles')
}
})