【发布时间】:2019-12-24 20:24:12
【问题描述】:
我在 react native 中使用 axios 发出一个 post 请求,除了在这个文件中它工作正常,为了测试我用 fetch api 替换它并且它工作正常。
我的代码中的第二行执行得很好,而第一行(使用 axios)没有,我在第一行和第三行注释了它,它打印了第一行的结果然后它可以工作,如果我取消注释它什么都不会打印(第一行停止下一行)
我确信 axios 已导入并可以正常工作,因为我有请求在同一个文件中工作。
//let response = await axios.post("http://testing.api.okatruck.com/api/customers/requestTripC",{})
let response2 = await fetch("http://testing.api.okatruck.com/api/customers/requestTripC",{method: 'POST'})
//console.log(response)
console.log(response2)
【问题讨论】:
标签: react-native axios