2021-01-15 00:10:06 +08:00
|
|
|
import type { Router } from 'vue-router';
|
|
|
|
|
import { appStore } from '/@/store/modules/app';
|
|
|
|
|
import { PageEnum } from '/@/enums/pageEnum';
|
|
|
|
|
import { removeTabChangeListener } from '/@/logics/mitt/tabChange';
|
|
|
|
|
|
2021-01-17 22:36:06 +08:00
|
|
|
export function createStateGuard(router: Router) {
|
2021-01-15 00:10:06 +08:00
|
|
|
router.afterEach((to) => {
|
|
|
|
|
// Just enter the login page and clear the authentication information
|
|
|
|
|
if (to.path === PageEnum.BASE_LOGIN) {
|
|
|
|
|
appStore.resumeAllState();
|
|
|
|
|
removeTabChangeListener();
|
|
|
|
|
}
|
|
|
|
|
});
|
|
|
|
|
}
|