Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

instagram-node return from callback #101

Open
petrkl opened this issue Jun 28, 2016 · 0 comments
Open

instagram-node return from callback #101

petrkl opened this issue Jun 28, 2016 · 0 comments

Comments

@petrkl
Copy link

petrkl commented Jun 28, 2016

I have a problem using instagram-node with Bluebird (promises library)
I make request to user_media_recent but chain .then (promise) not working.
In hdl function if before ruturn insert console.log(all) -> all fine with data.

Please, how can solve this issue.

Here is my code

var instagramApi  = require('instagram-node').instagram();
var Bluebird      = require('bluebird');
var all =[];

    var hdl = function(err, medias, pagination, remaining, limit) {
        for (var i in medias) {
            all.push(medias[i].id);
        }     
        if(pagination.next) {
            pagination.next(hdl); // Will get second page results 
        }
    else  return all;
    };

    instagramApi.user_media_recentAsync('222728214',{count:10},hdl)
    .then(function(data){
        console.log(data);
    });
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant