From ec9e583be395852de7d593bb130a1987ab3914b9 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?J=C3=B3rdan=20Luiz=20Bisato?= Date: Thu, 15 Feb 2018 10:47:46 -0200 Subject: [PATCH 1/2] update reste.js verify if response is null --- reste.js | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/reste.js b/reste.js index ac0e1ae..3ba7ad8 100644 --- a/reste.js +++ b/reste.js @@ -378,7 +378,7 @@ var main = function() { // if we have a config based transfor for th emodel // then attach this to the model, or create a default - if (reste.modelConfig && reste.modelConfig[name] && reste.modelConfig[name].transform) { + if (reste.modelConfig && reste.modelConfig[name] && reste.modelConfig[name].transform) { model.transform = function(model, transform) { if (transform) { this.__transform = transform(this); @@ -471,6 +471,7 @@ 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 @@ -492,6 +493,9 @@ var main = function() { Alloy.Collections[collectionConfig.name].trigger("sync"); } } + } else { + option.success(null); + } }, function(response) { if (options.error) { options.error(response); From f5e551d86324efcf01b1c0e522b7a6f4d611af2f Mon Sep 17 00:00:00 2001 From: jordanbisato Date: Thu, 15 Feb 2018 11:18:09 -0200 Subject: [PATCH 2/2] Update reste.js --- reste.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/reste.js b/reste.js index 3ba7ad8..b11a5cb 100644 --- a/reste.js +++ b/reste.js @@ -494,7 +494,7 @@ var main = function() { } } } else { - option.success(null); + option.success(response); } }, function(response) { if (options.error) {