Skip to content

πŸ“š The open-source, offline-first Notion, Obsidian & Confluence alternative. Advanced Markdown, multi-tenant teams, OIDC/SSO, and local S3 backups. Deploy in one command.

493 B
Raw Blame
export default defineNuxtRouteMiddleware(async (to, _) => {
  if (!to.path.startsWith('/dashboard')) return;

  if (import.meta.client) {
    const preferencesStore = usePreferencesStore();
    const collapseStore = useCollapseStore();

    // console.log('🚦 [Middleware] Blocking route until stores are ready...');

    await Promise.all([collapseStore.untilReady, preferencesStore.untilReady]);

    // console.log('🟒 [Middleware] Stores are ready, allowing route:', to.path);
  }
});