【发布时间】:2020-11-28 12:52:35
【问题描述】:
有人,请帮我一个接一个地调用这些 fetch Api,因为我正在使用存储在后端的数据来处理我的下一个请求。我希望以这种方式依次调用它们一个完整然后下一个请求。
Promise.all([
fetch(`http://localhost:5000/zoomapi`,
requestOptions),
fetch('http://localhost:5000/getId')
.then((res) => res.json())
.then((result) => {
this.setState({ zoomid: result });
}),
fetch(`http://localhost:5000/users/zoom?name=${this.state.zoomid}`)
.then((res) => res.json())
.then((result) => {
this.setState({ zoomdata: result });
})
])
.catch((error) => {
this.setState({ error });
});
})
【问题讨论】:
标签: javascript node.js reactjs api fetch