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] 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);