Authored by htoo

hotfix(home): fix error

... ... @@ -55,22 +55,24 @@ const uploadImg = (req, res, next) => {
file: f,
uid: req.user.uid.toString(),
method: 'yoho.fileupload'
}).then(result => {
if (result.code !== 200) {
return Promise.reject(Error('上传出错'));
}
return result;
});
})
).then(result => {
const images = result.reduce((t, r) => {
if (r && r.data && r.code === 200) {
t.push(utils.getUploadImgAbsoluteUrl(_.get(r, 'data'), req.body.bucket));
}
const data = result.reduce((t, r) => {
t.images.push(utils.getUploadImgAbsoluteUrl(_.get(r, 'data'), req.body.bucket));
t.imageList.push(_.get(r, 'data'));
return t;
}, []);
}, { images: [], imageList: [] });
res.json({
code: 200,
data: {
images,
imageList: images
},
data,
message: '上传成功'
});
}).catch(next);
... ...
... ... @@ -35,7 +35,8 @@ _.mergeWith(baseConfig, {
},
headers: {
'Access-Control-Allow-Origin': '*'
}
},
disableHostCheck: true
},
plugins: [
new ExtractTextPlugin('[name].css'),
... ...