reactjs - Axios 删除不起作用,它在 chorme 的网络选项卡中显示待处理状态
问题描述
我正在使用 axios Delete 方法删除我的记录。当我发送请求时,它没有返回任何响应。我在 chrome 的 networktab 中看到,API 状态为挂起状态。我正在使用 Redux 和 React。下面是我的代码
我在 Action.js 中导入 service.js 文件
Action.js file
const delete = formData => {
return async dispatch => {
const data = deleteservice.deleteRetail(formData)
.then({
console.log(response)
}).catch(error => {
console.log(error);
})
}
}
service.js
export const deleteRetail = (formData) => {
return axios({
method: 'DELETE,
URL : myURL,
headers: {
'content-type' : 'application/json'
},
data : {
userID: 'test',
userName : 'test'
}
})
}
这是我的代码,当我调用这个 delete url 时,状态在网络中显示为待处理。没有得到任何回应。请建议我解决方案
解决方案
推荐阅读
- python - 如何从 python3 支持 ansible-playbook
- java - 如何通过 Keycloak Java API 根据资源类型发出授权请求?
- react-native - 如何在 React Native 中为相同名称的平面列表组合不同的选择器值
- java - 列出目录中的所有文件并为特定的 mimetype 添加过滤器
- unity3d - loadScene 后 PUN2 未连接
- javascript - 如何在带有 typescript 的 React.clone 中使用 props.children?
- okular - okular:禁用注释的键盘快捷键
- asp.net - 如何在 ASP.NET 中从数据库中设置电子邮件和密码值
- android - 在 Kotlin 中更改日期的后退按钮和前进按钮
- javascript - 文件更改时运行 tsc 时 nodemon 不工作