simple api encapsulation
export const weChatAndSinaAcount = () => {
return $http.get(API_HOST + "/channel/getChannelRecordNum").then(res => res.data)
}
call data and return
getWeChatAndSinaAcount () {
weChatAndSinaAcount().then(res => {
console.log(res)
if (res.code === 1) {
let data = res.data
console.log(data)
}
}).catch(err => {
console.log("Error Info:" + JSON.stringify(err))
})
}
return the result
Error Info:{"message":"","code":0,"data":[{"channelType":"","sumRecordNum":"0"},{"channelType":"","sumRecordNum":"0"}]}
you can see that the data request was successful (code=0 indicates success), but did not return
in then