Skip to content Skip to sidebar Skip to footer

Can't Successfully Pass Through A Callback Into A Function Chain

I'm using the codebird library to perform some requests to the Twitter API. These requests respond correctly but I want to pass that response through to my route. Here is a snippet

Solution 1:

You have to change callApi method to pass "callback" as parameter and not call it.

var callAPI = function(callback) {

  getAccessToken(callback);
  // and not getAccessToken(callback());console.log('callAPI function loaded');
};

The difference is, in you code you are calling the callback just after authentication.

After my change, you pass the callback to getUserTweets function, and it will call the callback after tweets fetched.

Post a Comment for "Can't Successfully Pass Through A Callback Into A Function Chain"