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()
|
const { ensureSession, activeProfile } = useProfileSession()
|
||||||
await ensureSession()
|
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) {
|
if (!activeProfile.value && !isProfilesRoute) {
|
||||||
return navigateTo('/profiles')
|
return navigateTo('/profiles')
|
||||||
|
|||||||
Reference in New Issue
Block a user