I'm trying to request a JSON structure that is not common for the Ember default adapter. The response does not have the root key. Here's what I mean:
[
{
name: 'Dude'
fullName: 'Nice Dude'
},
{
name: 'Foo'
fullName: 'Foo Bar'
}
]
So, let's say that this is the response for GET /users.
I can workaround and successfully resolve this writing this boilerplate:
import DS from 'ember-data';
export default DS.RESTSerializer.extend({
normalizePayload: function(payload) {
return { user: payload };
}
});
But this is totally wrong, cause i'm overwriting all payload responses. Which would be the clean way of normalizing only GET /users payload?
Aucun commentaire:
Enregistrer un commentaire