d5be3c7a by Adam Heath

Deal with an errorMessage being sent, by copying it into the model.

1 parent aef73065
...@@ -199,7 +199,13 @@ define(function(require) { ...@@ -199,7 +199,13 @@ define(function(require) {
199 } 199 }
200 function api(apiName, data) { 200 function api(apiName, data) {
201 var apiHandler = globalOptions.api || function(apiName, data) {}; 201 var apiHandler = globalOptions.api || function(apiName, data) {};
202 return apiHandler(apiName, data, {sessionId: self.get('sessionId')}).done(applyLoginResults); 202 return apiHandler(apiName, data, {sessionId: self.get('sessionId')}).always(function() {
203 self.unset('errorMessage');
204 }).done(applyLoginResults).error(function(xhr) {
205 if (xhr.responseJSON && xhr.responseJSON.errorMessage) {
206 self.set('errorMessage', xhr.responseJSON.errorMessage);
207 }
208 });
203 } 209 }
204 var addProviderData = _.bind(function addProviderData() { 210 var addProviderData = _.bind(function addProviderData() {
205 var args = _.toArray(arguments); 211 var args = _.toArray(arguments);
......