I am new to promises back-end in general, so apologies if this is a dumb question. receivePublicToken() is a method being called from a REST endpoint. I am then trying to call an axios function within that method's then method (aka, if the receivePublicToken() method succeeds, continue on and call another axios function). The axios function always returns an error.
import { receivePublicToken } from "./controller";
receivePublicToken(req)
.then(resolve => {
console.log("Resolved: ", resolve);
axios.get("/transactions")
.then(res => console.log("Axios succeeded!"))
.catch(rej => console.log("Axios failed!")); //this always fails
})
.catch(reject => {
console.log("Reject: ", reject);
});
The error it gives me:
{ Error: connect ECONNREFUSED 127.0.0.1:80
at TCPConnectWrap.afterConnect [as oncomplete] (net.js:1107:14)
Any thoughts? Alternatively, if anyone has any suggestions on a better approach to this, I'm all ears. Thank you to all in advance! :)