From ac948bbf5eb0eba17fd9f1d447148ae719fcd98c Mon Sep 17 00:00:00 2001 From: Matthieu Date: Thu, 18 Sep 2025 08:40:09 +0200 Subject: [PATCH] fix: ensure profile middleware respects full path --- app/middleware/profile.global.ts | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/app/middleware/profile.global.ts b/app/middleware/profile.global.ts index d077317..518b4f7 100644 --- a/app/middleware/profile.global.ts +++ b/app/middleware/profile.global.ts @@ -6,10 +6,16 @@ export default defineNuxtRouteMiddleware(async (to) => { const rawPath = to?.path ?? '' const normalizedPath = rawPath.startsWith('/') ? rawPath : `/${rawPath}` + const fullPath = to?.fullPath ?? normalizedPath const routeName = typeof to?.name === 'string' ? to.name : '' - const isProfilesRoute = normalizedPath.startsWith('/profiles') || routeName.startsWith('profiles') + const isProfilesRoute = + normalizedPath.startsWith('/profiles') || + fullPath.startsWith('/profiles') || + routeName.startsWith('profiles') if (!activeProfile.value && !isProfilesRoute) { - return navigateTo('/profiles') + if (!normalizedPath.startsWith('/profiles')) { + return navigateTo('/profiles') + } } })