mirror of
https://github.com/flarum/framework.git
synced 2024-11-26 10:14:16 +08:00
Move extractMeta override to serializer
This commit is contained in:
parent
071e403020
commit
eec50f687c
|
@ -5,15 +5,6 @@ import config from '../config/environment';
|
|||
export default JsonApiAdapter.extend({
|
||||
host: config.apiURL,
|
||||
|
||||
// We can get rid of this after
|
||||
// https://github.com/kurko/ember-json-api/pull/59 is merged.
|
||||
extractMeta: function(store, type, payload) {
|
||||
if (payload && payload.meta) {
|
||||
store.metaForType(type, payload.meta);
|
||||
delete payload.meta;
|
||||
}
|
||||
},
|
||||
|
||||
ajaxError: function(jqXHR) {
|
||||
var errors = this._super(jqXHR);
|
||||
if (errors instanceof DS.InvalidError) {
|
||||
|
@ -30,4 +21,4 @@ export default JsonApiAdapter.extend({
|
|||
return errors;
|
||||
}
|
||||
|
||||
});
|
||||
});
|
||||
|
|
|
@ -1,13 +1,22 @@
|
|||
import JsonApiSerializer from 'ember-json-api/json-api-serializer';
|
||||
|
||||
export default JsonApiSerializer.extend({
|
||||
normalize: function(type, hash, property) {
|
||||
var json = {};
|
||||
normalize: function(type, hash, property) {
|
||||
var json = {};
|
||||
|
||||
for (var prop in hash) {
|
||||
json[prop.camelize()] = hash[prop];
|
||||
}
|
||||
for (var prop in hash) {
|
||||
json[prop.camelize()] = hash[prop];
|
||||
}
|
||||
|
||||
return this._super(type, json, property);
|
||||
}
|
||||
});
|
||||
return this._super(type, json, property);
|
||||
},
|
||||
|
||||
// We can get rid of this after
|
||||
// https://github.com/kurko/ember-json-api/pull/59 is merged.
|
||||
extractMeta: function(store, type, payload) {
|
||||
if (payload && payload.meta) {
|
||||
store.setMetadataFor(type, payload.meta);
|
||||
delete payload.meta;
|
||||
}
|
||||
}
|
||||
});
|
||||
|
|
Loading…
Reference in New Issue
Block a user