Skip to content

Commit ea9e145

Browse files
authored
fix: 修正如果在使用了 userStore 内的数据的页面进行退出登录操作时会因为相关数据提前清除而报错的问题 (#274)
* fix: 修正如果在使用了 userStore 内的数据的页面进行退出登录操作时会因为相关数据提前清除而报错的问题 * fix: 移除多余的
1 parent 490ca95 commit ea9e145

1 file changed

Lines changed: 5 additions & 3 deletions

File tree

src/permission.ts

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -18,8 +18,6 @@ router.beforeEach(async (to, from, next) => {
1818
const { token } = userStore;
1919
if (token) {
2020
if (to.path === '/login') {
21-
userStore.logout();
22-
permissionStore.restore();
2321
next();
2422
return;
2523
}
@@ -58,6 +56,10 @@ router.beforeEach(async (to, from, next) => {
5856
}
5957
});
6058

61-
router.afterEach(() => {
59+
router.afterEach((to) => {
60+
if (to.path === '/login') {
61+
userStore.logout();
62+
permissionStore.restore();
63+
}
6264
NProgress.done();
6365
});

0 commit comments

Comments
 (0)