fix: guard profile middleware on profiles routes
This commit is contained in:
@@ -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')
|
||||
|
||||
Reference in New Issue
Block a user