0

所以我在本地遇到问题当我提出请求时,我得到了数据,在 Dev/QA/Prod 上什么都没有回来我检查了浏览器上的网络开发工具,我看到请求被取消了

示例图像

4

1 回答 1

0

因此,当您在调用完成之前返回/重新加载窗口时会发生这种情况(所做的 API 调用仍在处理中且尚未完成)。

onRemove = (evt) => {
  evt.preventDefault();
  evt.stopPropagation();
  this.props.onRemove(this.props.item);          
  window.location.reload(); // this will cancel the call and your request wont 
  //be execute.
}

删除它会对问题进行排序->“window.location.reload();” 最好的办法是确保在执行任何其他操作之前等待请求被处理。

onRemove = (evt) => {
  evt.preventDefault();
  evt.stopPropagation();
  this.props.onRemove(this.props.item);          
  
}
于 2020-07-27T14:18:51.957 回答