优化退出登录

This commit is contained in:
TOP糯米 2023-04-01 21:52:19 +08:00
parent 503c6f097f
commit 8cb24c17e7
2 changed files with 10 additions and 6 deletions

View File

@ -203,11 +203,11 @@ export default {
* 注销登录 * 注销登录
*/ */
logout() { logout() {
prototype.$storage.set('user_access_token', null); return new Promise((resolve, reject) => {
prototype.$storage.set('userinfo', null); prototype.$storage.set('user_access_token', null);
$store.commit('user/token', ""); prototype.$storage.set('userinfo', null);
prototype.$utils.toast('请重新登录').then(() => { $store.commit('user/token', "");
prototype.$utils.toPage('/pages/index/index', {}, 'switch'); return resolve();
}); });
} }
} }

View File

@ -60,7 +60,11 @@ export default {
this.$utils.toPage(url); this.$utils.toPage(url);
}, },
logout() { logout() {
this.$models.user.logout(); this.$models.user.logout().then(() => {
this.$utils.toast("退出成功").then(() => {
this.$utils.toPage("/pages/index/index", {}, "switch");
});
});
}, },
}, },
}; };