aboutsummaryrefslogtreecommitdiffstats
path: root/middleware/editor.global.ts
blob: 5d722730e66b0e1b48be1d3b6d47d1cfeed48654 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
import { useSessionStore } from '@/stores/session';

export default defineNuxtRouteMiddleware((to, from) => {
  const session = useSessionStore();

  if (to.fullPath === '/' && session.getSessionType() !== 'none') {
    return navigateTo('/editor');
  }

  if (to.fullPath.startsWith('/editor') && session.getSessionType() === 'none') {
    return navigateTo('/');
  }
});