843606775c
* parallel middlewares foundation + hydration mismatch * moved to fully parallel middlewares * a bit less hacky * some more cleanup * improved nuxt 4 error formatting * make parallel middlewares toggleable
15 lines
477 B
TypeScript
15 lines
477 B
TypeScript
import { useSetActiveWorkspace } from '~/lib/user/composables/activeWorkspace'
|
|
|
|
/**
|
|
* Clear active workspace when navigating to the projects page
|
|
*/
|
|
export default defineParallelizedNuxtRouteMiddleware(async () => {
|
|
const { setActiveWorkspace } = useSetActiveWorkspace()
|
|
const { isLoggedIn } = useActiveUser()
|
|
const isWorkspacesEnabled = useIsWorkspacesEnabled()
|
|
|
|
if (isLoggedIn.value && isWorkspacesEnabled.value) {
|
|
await setActiveWorkspace({ id: null })
|
|
}
|
|
})
|