Authored by htoooth

fix needlogin

... ... @@ -25,7 +25,7 @@ const request = async({url, method, reqParams = {}, context}) => {
},
sessionKey: user.sessionKey,
appSessionType: user.appSessionType
} : 1,
} : null,
method: apiInfo.api,
});
}
... ...
... ... @@ -143,7 +143,7 @@ export default {
this.toast && this.toast.hide();
if (result.code === 200) {
if (result && result.code === 200) {
this.$store.commit('license/form/FETCH_UFO_STATUS_SUCCESS', 0);
} else {
this.$createToast({
... ... @@ -186,11 +186,19 @@ export default {
this.model.certFaceImage.length === 1 &&
this.model.certReverseImage.length === 1 &&
(this.model.time.noLimit ? this.model.time.start_time : this.model.time.start_time && this.model.time.expire_time);
}
},
...mapState(['needLogin'])
},
mounted() {
this.fetchToken();
},
watch: {
needLogin(newVal) {
if (newVal) {
this.$yoho.goLogin({});
}
}
},
components: {
LayoutApp,
FixedBottom,
... ...
... ... @@ -30,16 +30,23 @@ export default {
},
async saveLicense({ commit }, data) {
const result = await this.$api.post(
let result = {};
try {
result = await this.$api.post(
'/api/ufo/license/save',
_handleData(data)
);
} catch (e) {
commit(Types.FETCH_UFO_NEED_LOGIN, true);
return result;
}
return result;
},
async licenseStatus({ commit }) {
let result = null;
let result = {};
try {
result = await this.$api.get('/api/ufo/license/status');
... ... @@ -58,7 +65,13 @@ export default {
},
async getStoreStatus({ commit }) {
const result = await this.$api.get('/api/ufo/store/status');
let result = {};
try {
result = await this.$api.get('/api/ufo/store/status');
} catch (e) {
return result;
}
return result;
}
... ...
... ... @@ -7,7 +7,8 @@ const qiniu = require('qiniu');
const qiniuConfig = global.yoho.config.qiniu;
const qiniuYohoCdnConfig = global.yoho.config.qiniuYohoCdn;
function getToken(req, res) {
function getToken(req, res, next) {
try {
let conf = qiniuConfig;
let type = req.query.type || '';
... ... @@ -26,6 +27,9 @@ function getToken(req, res) {
code: 200,
uptoken: uploadToken
});
} catch (e) {
return next(e);
}
}
module.exports = {
... ...
... ... @@ -25,7 +25,7 @@ module.exports = async(req, res, next) => {
},
sessionKey: req.user.sessionKey,
appSessionType: req.user.appSessionType
} : 0,
} : null,
method: apiInfo.api
};
}
... ...