Species edit refactor (wip)
This commit is contained in:
parent
cdc825cc6a
commit
622cd0faaf
11 changed files with 155 additions and 124 deletions
|
@ -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;
|
||||
}
|
||||
}
|
||||
},
|
||||
});
|
||||
|
|
Reference in a new issue