feat: add profile management flow
This commit is contained in:
12
app/middleware/profile.global.ts
Normal file
12
app/middleware/profile.global.ts
Normal file
@@ -0,0 +1,12 @@
|
||||
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')
|
||||
}
|
||||
})
|
||||
Reference in New Issue
Block a user