fix: guard profile middleware on profiles routes

This commit is contained in:
Matthieu
2025-09-18 08:30:29 +02:00
parent 316dcb6339
commit 95c1e66520

View File

@@ -4,7 +4,9 @@ export default defineNuxtRouteMiddleware(async (to) => {
const { ensureSession, activeProfile } = useProfileSession()
await ensureSession()
const isProfilesRoute = to.path.startsWith('/profiles')
const path = to.path || ''
const routeName = typeof to.name === 'string' ? to.name : ''
const isProfilesRoute = path.startsWith('/profiles') || routeName.startsWith('profiles')
if (!activeProfile.value && !isProfilesRoute) {
return navigateTo('/profiles')