From bde3b7375a324a5e10132efad439063cd8e98c70 Mon Sep 17 00:00:00 2001 From: Piotr Sarnacki Date: Thu, 7 Jan 2016 10:22:18 +0100 Subject: [PATCH] Fix displaying flashes coming from the server --- app/services/ajax.js | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/app/services/ajax.js b/app/services/ajax.js index 8885e240..8fd158b9 100644 --- a/app/services/ajax.js +++ b/app/services/ajax.js @@ -77,17 +77,17 @@ export default Ember.Service.extend({ options.contentType = options.contentType || 'application/json; charset=utf-8'; } success = options.success || (function() {}); - options.success = (body, status, xhr) => { + options.success = (data, status, xhr) => { if (data != null ? data.flash : void 0) { Travis.lookup('controller:flash').loadFlashes(data.flash); } if (data != null) { delete data.flash; } - return success.call(this, body, status, xhr); + return success.call(this, data, status, xhr); }; error = options.error || function() {}; - options.error = (body, status, xhr) => { + options.error = (data, status, xhr) => { console.log("[ERROR] API responded with an error (" + status + "): " + (JSON.stringify(data))); if (data != null ? data.flash : void 0) { Travis.lookup('controller:flash').pushObject(data.flash); @@ -95,7 +95,7 @@ export default Ember.Service.extend({ if (data != null) { delete data.flash; } - return error.call(this, body, status, xhr); + return error.call(this, data, status, xhr); }; options = $.extend(options, default_options);