fix: 修正如果在使用了 userStore 内的数据的页面进行退出登录操作时会因为相关数据提前清除而报错的问题 (#274)

* fix: 修正如果在使用了 userStore 内的数据的页面进行退出登录操作时会因为相关数据提前清除而报错的问题

* fix: 移除多余的
This commit is contained in:
PDieE 2022-08-24 16:18:42 +08:00 committed by GitHub
parent 490ca9570d
commit ea9e14507a
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -18,8 +18,6 @@ router.beforeEach(async (to, from, next) => {
const { token } = userStore;
if (token) {
if (to.path === '/login') {
userStore.logout();
permissionStore.restore();
next();
return;
}
@ -58,6 +56,10 @@ router.beforeEach(async (to, from, next) => {
}
});
router.afterEach(() => {
router.afterEach((to) => {
if (to.path === '/login') {
userStore.logout();
permissionStore.restore();
}
NProgress.done();
});