Blame view

src/router/guard/stateGuard.ts 483 Bytes
1
2
3
4
5
import type { Router } from 'vue-router';
import { appStore } from '/@/store/modules/app';
import { PageEnum } from '/@/enums/pageEnum';
import { removeTabChangeListener } from '/@/logics/mitt/tabChange';
6
export function createStateGuard(router: Router) {
7
8
9
10
11
12
13
14
  router.afterEach((to) => {
    // Just enter the login page and clear the authentication information
    if (to.path === PageEnum.BASE_LOGIN) {
      appStore.resumeAllState();
      removeTabChangeListener();
    }
  });
}