{“消息”:“请求失败,状态代码401",”名称“:”错误“,“堆栈”:“错误:请求失败,状态代码401\n位于(/home/user/Projects/HealthBlock/node_modules/axios/lib/core/createError.js:16:15)\n (/home/user/Projects/HealthBlock/node_modules/axios/lib/core/settle.js:17:12)\n at createError IncomingMessage.handleStreamEnd at IncomingMessage.handleStr
我已经为我的服务创建了一个axios拦截器,场景是如果特定的api调用失败。它将重定向到错误组件。但是它给了我错误的Error: Invalid hook call. Hooks can only be called inside of the body of a function component.
下面是我的agent.ts代码:
axios.defaults.baseURL = "https://localhost:5001/api/";
const responseBody = (response: AxiosResponse) => response.
编辑:尝试了下面的建议,以及更多的东西,现在这是代码,我几乎只是让所有异步等待,而不是那时和捕获.
makeNextAccount();
console.log("Making :" + merchantsToCreate.length + " Accounts")
async function makeNextAccount(currentIndex) {
for (const item of merchantsToCreate) {
try{
let accId = "";
var creat