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') } })