Species edit refactor (wip)

This commit is contained in:
Matthew Dillon 2015-07-06 11:02:41 -08:00
parent cdc825cc6a
commit 622cd0faaf
11 changed files with 155 additions and 124 deletions

View file

@ -5,10 +5,13 @@ export default DS.RESTAdapter.extend({
namespace: function() {
return 'api/' + this.get('globals.genus');
}.property(),
host: function() {
return this.get('globals.apiURL');
}.property(),
coalesceFindRequests: true,
ajaxError: function(jqXHR) {
// http://stackoverflow.com/a/24027443
var error = this._super(jqXHR);
@ -22,8 +25,13 @@ export default DS.RESTAdapter.extend({
});
}
return new DS.InvalidError(errors);
} else if (jqXHR && jqXHR.status === 500) {
var response = Ember.$.parseJSON(jqXHR.responseText);
if (response.error !== undefined) {
return new DS.InvalidError(response.error);
}
} else {
return error;
}
}
},
});