refactor(member): 提取公共登录态清理和注销逻辑到mixin
重构会员相关页面的重复代码,将清除登录态、退出登录、账号注销相关逻辑抽离到公共mixin中,统一复用代码并减少重复维护成本
This commit is contained in:
@@ -37,7 +37,10 @@
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import memberPublic from './public/js/member-public.js';
|
||||
|
||||
export default {
|
||||
mixins: [memberPublic],
|
||||
data() {
|
||||
return {
|
||||
state: 0
|
||||
@@ -67,10 +70,7 @@
|
||||
}
|
||||
|
||||
if (res.code == -1) {
|
||||
this.$store.commit('setToken', '');
|
||||
this.$store.commit('setMemberInfo', '');
|
||||
this.$store.commit('setMemberInfo', '');
|
||||
this.$store.dispatch('emptyCart');
|
||||
this.clearLoginState();
|
||||
this.$util.redirectTo(this.$util.INDEX_PAGE_URL);
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user