await axios
.post(
executeBatch,
{
headers: {
"Content-Type": "application/json",
"x-access-token": localStorage.getItem("token"),
},
}
)
.then(
(response) =>
this.$store.commit(
"insertOutputFile",
response.data.outputFile._id
),
);
alert("You can download the result");
所以有时我会得到状态码为 200 的空响应, 正在考虑如果发生这种情况重试该请求, 我想知道解决这个问题的正确方法是什么。
Copyright 2014-2025 https://www.php.cn/ All Rights Reserved | php.cn | 湘ICP备2023035733号
我认为 axios 拦截器适合你。
您可以在基本 redux 目录中创建 setupAxios 文件,并从基本 redux 目录中的 index.js 导出它。
export {default as setupAxios} from "./setupAxios";并从根index.js文件定义setupAxios
顺便说一句,我使用的是react.js,vue.js 中的它可能有点不同。