Skip to content

Promise Chains #3251

@ghost

Description

Quick question, has Parse.Promise.when chaining changed from parse.com to parse-server? I don't seem to be returning the correct item.

return Parse.Promise.when([
    Parse.Cloud.httpRequest({
        url:'https://graph.facebook.com/v2.1/me?fields=picture.height(50).width(50),email,first_name,last_name,friends.limit(5000),name,gender&access_token='+access_token
    }), Parse.Cloud.httpRequest({
        url:'https://graph.facebook.com/v2.1/me?fields=picture.height(500).width(500)&access_token='+access_token
    })]).then(function (facebookResponse, facebookImage) {

        // Append larger image to response
        try {
            facebookResponse.data.pictureLarge = {};
            facebookResponse.data.pictureLarge.data = {};
            facebookResponse.data.pictureLarge.data.url = facebookImage.data.picture.data.url;
        } catch(e) {}

        return facebookResponse;

    }, function (error) {

        // Can catch it and return a success
        return Parse.Promise.as(false);

    }).then(function (facebookResponse) {

        // Success
        return facebookResponse;

    });

On parse.com, it would return facebookResponse, and on parse-server, I'm getting [facebookResponse, facebookImage] instead of facebookResponse.

Any ideas?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions