13 lines
342 B
TypeScript
13 lines
342 B
TypeScript
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')
|
|
}
|
|
})
|