vendredi 27 novembre 2015

Ember normalize response

I'm extending the JSONSerializer in order to fit my server response which looks like this:

{
  "result": {
    "items": [
      {
        "id": "...",
        "title": "...",
        ...
      },
      ...
    ],
      "total": number,
      "...": "..."
  }   
}

therefore I have overridden normalizeResponse() method:

normalizeResponse: function(store, primaryModelClass, payload, id, requestType) {
        payload = payload.result.items;

        return this._super(store, primaryModelClass, payload, id, requestType)
    },

after this my model data fields are all undefined. What I'm doing wrong?




Aucun commentaire:

Enregistrer un commentaire