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) {
}
function api(apiName, data) {
var apiHandler = globalOptions.api || function(apiName, data) {};
return apiHandler(apiName, data, {sessionId: self.get('sessionId')}).done(applyLoginResults);
return apiHandler(apiName, data, {sessionId: self.get('sessionId')}).always(function() {
self.unset('errorMessage');
}).done(applyLoginResults).error(function(xhr) {
if (xhr.responseJSON && xhr.responseJSON.errorMessage) {
self.set('errorMessage', xhr.responseJSON.errorMessage);
}
});
}
var addProviderData = _.bind(function addProviderData() {
var args = _.toArray(arguments);
......