Authored by htoooth

fix needlogin

... ... @@ -27,16 +27,20 @@ export default {
methods: {
},
computed: {
...mapState(['status'])
...mapState(['status', 'needLogin'])
},
components: {
FormPage,
StatusPage,
LayoutApp
},
mounted() {
if (this.needLogin) {
this.$yoho.goLogin({});
}
}
};
</script>
<style lang="scss" scoped>
</style>
... ...
... ... @@ -43,12 +43,14 @@ export default {
if (result.code === 200) {
commit(Types.FETCH_UFO_STATUS_SUCCESS, result.data);
} if (result.code === 401) {
commit(Types.FETCH_UFO_NEED_LOGIN, true);
} else {
commit(Types.FETCH_UFO_STATUS_SUCCESS, -1);
}
},
async getStoreStatus({commit}) {
async getStoreStatus({ commit }) {
const result = await this.$api.get('/api/ufo/store/status');
return result;
... ...
... ... @@ -7,7 +7,8 @@ export default function() {
state: {
fetching: false,
token: false,
status: -1
status: -1,
needLogin: false
},
actions,
mutations
... ...
... ... @@ -7,5 +7,9 @@ export default {
[Types.FETCH_UFO_STATUS_SUCCESS](state, data) {
state.status = data;
},
[Types.FETCH_UFO_NEED_LOGIN](state, data) {
state.needLogin = data;
}
};
... ...
... ... @@ -6,3 +6,5 @@ export const FETCH_UFO_SAVE_ERROR = 'FETCH_UFO_SAVE_ERROR';
export const FETCH_UFO_STATUS_REQUEST = 'FETCH_UFO_STATUS_REQUEST';
export const FETCH_UFO_STATUS_SUCCESS = 'FETCH_UFO_STATUS_SUCCESS';
export const FETCH_UFO_STATUS_ERROR = 'FETCH_UFO_STATUS_ERROR';
export const FETCH_UFO_NEED_LOGIN = 'FETCH_UFO_NEED_LOGIN';
... ...