【发布时间】:2023-01-17 05:01:56
【问题描述】:
如何使用相同的响应对象调用两次?
function a() {
return axios.get('/foo').then(function(resp){
// do something with resp, eg. if 401 then force local state to logout
})
}
// the caller:
a().then(function(resp) {
// not called, I want same resp, not just data
}).catch(console.log).then(clearLoadingBar)
【问题讨论】:
标签: javascript axios promise chaining