【发布时间】:2018-05-13 15:53:36
【问题描述】:
我很困惑如何继续获取所有其他信息索引的 Test1 的结果,所以如果 Test1 为真,即使 Test2 和 Test3 为空,它也会根据 Test1 继续打印真
let info = ["Test1", "Test2", "Test3"];
isInfoAviable= (email) => {
payload.info = info
return axios.post(url, payload, axiosConfig).then((response) => {
return response.data.isAvailable ? true : null
}).catch((error) => {
console.log(error);
});
}
for (info of infos) {
isInfoAviable(info).then((res) => {
console.log(res) // If Test1 returns true, it'll true even if Test2 is null, why?
})
}
【问题讨论】:
标签: javascript promise axios