samedi 8 avril 2017

Ember JSON API does not recognize id in API response

I do a this.get('model').save() in my controller and get the following error:

Your users record was saved to the server, but the response does not have an id and no id has been set client side. Records must have ids. Please update the server response to provide an id in the response or generate the id on the client side either before saving the record or while normalizing the response.

My Serializer looks like this: app/serializers/application.js

import DS from 'ember-data';
export default DS.JSONAPISerializer.extend({
});

My API response is:

{
  "data":
  {
    "id":"20",
    "type":"users",
    "attributes":
    {
        "first-name":"Lalit",
        "last-name":"Indoria",
        "email":"l.k.indoria@gmail.com",
        "created-at":"2017-04-08T17:18:02Z",
        "updated-at":"2017-04-08T17:18:02Z"
    }
  }
}

What am I doing wrong?




Aucun commentaire:

Enregistrer un commentaire