Deal with an errorMessage being sent, by copying it into the model.
Showing
1 changed file
with
7 additions
and
1 deletions
... | @@ -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); | ... | ... |
-
Please register or sign in to post a comment