Node.js Axios-在主URL失败时调用辅助URL
有没有办法将辅助url配置为?。当主url失败时,它必须调用辅助url。您可以调用第一个url中的第二个:Node.js Axios-在主URL失败时调用辅助URL,node.js,axios,Node.js,Axios,有没有办法将辅助url配置为?。当主url失败时,它必须调用辅助url。您可以调用第一个url中的第二个: axios .get('url') .then(response => { // handle response }) .catch(error => { axios .get('url2') .then(response => {
axios
.get('url')
.then(response => {
// handle response
})
.catch(error => {
axios
.get('url2')
.then(response => {
// handle response
});
});
我开发了一个模块,有一个类似的模块,在出现身份验证错误时,它尝试登录,然后重试最初的调用。你可以用它来实现你想要的。@EmileBergeron非常感谢!!我将从
axios
尝试itAny功能?或者我们应该像你的答案那样手动操作?据我所知,并没有链接调用。。所以我的客人就是我给你的awnser。。