We have a chained promise framework type thing set up. It does an async call, a .then()
which processes the response then resolves or rejects the promise, another component that adds a .then()
to the promise, and finally this is utilized inside individual components.
This scenario makes no sense to me:
First then
calls reject
on the promise.
Second then
calls its reject
callback.
Third then
calls its resolve
callback.
I would think the third would call its reject
callback as well. The goal is that if resolve is called all then
s utilize their individual resolve
callbacks, if it's rejected each then
uses its reject
callback.
TheAJAXCall(){
return new Promise(function(resolve, reject){
axios({
//doesn't matter what is here, just pretend it works
}).then(function(response){
reject(response)
});
});
}
SetupOurCall(){
return TheAJAXCall().then(function(){
console.log("second then resolved"); //ignored as expected
return response;
}, function(){
console.log("second then rejected"); //called as expected
})
}
MyFunction = function(){
SetupOurCall().then(function(){
console.log("How did I get resolved"); //this is resolved?!?!?
}, function(){
console.log("I want this to be rejected"); //why not rejected?
})
}