aboutsummaryrefslogtreecommitdiffstats
path: root/middleware/editor.global.ts
blob: 82df54b736ccdbb30960c6618ef165bd0c6239cd (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('/');
  }
});