Skip to content

Commit

Permalink
fix an issue where ignoring config.content wasn't respected
Browse files Browse the repository at this point in the history
  • Loading branch information
jasonkneen committed Mar 28, 2018
1 parent 8ece112 commit 39753e4
Showing 1 changed file with 8 additions and 6 deletions.
14 changes: 8 additions & 6 deletions reste.js
Original file line number Diff line number Diff line change
Expand Up @@ -485,7 +485,6 @@ var main = function() {
methodCall(options, function(response) {

if ((response != null) && (response != undefined)) {
if (options.success && response[collectionConfig.content]) {

// check if we have a return property
if (response[collectionConfig.content]) {
Expand All @@ -494,25 +493,28 @@ var main = function() {
item.id = item[modelConfig.id];
});

options.success(response[collectionConfig.content]);
if (options.success) options.success(response[collectionConfig.content]);

Alloy.Collections[collectionConfig.name].trigger("sync");

} else {

// otherwise just return an array with the response
response.forEach(function(item) {
item.id = item[modelConfig.id];
});

options.success(response);
if (options.success) options.success(response);

Alloy.Collections[collectionConfig.name].trigger("sync");
}
}
} else {
option.success(response);
}
}, function(response) {

if (options.error) {
options.error(response);
}

});

} else if ( model instanceof Backbone.Model) {
Expand Down

0 comments on commit 39753e4

Please sign in to comment.