jeudi 7 juillet 2016

EmberJS error deleting record from model

When I delete an item from my database, I get the following error

Attempted to handle event `pushedData` on <app@model:mymodel::ember851:myid> while in state root.deleted.inFlight.

But sometimes the error change to:

Error: Attempted to handle event `notFound` on <hightrack-webapp@model:mymodel::ember851:myid> while in state root.deleted.saved. 

My model is:

export default Model.extend({
    position: attr('number'),
    name: attr('string'),
    shared: attr('boolean', { defaultValue: false }),
    color: attr(),
    textColor: attr(),
    permissions: attr(),
    calendarstack: belongsTo('calendarstack'),
    event: hasMany('event'),
    isActive: attr()
});

And my code to delete the record:

delete: function(type, id){
  var that = this;
  this.store.findRecord(type, id).then(function(data) {
    data.deleteRecord();
    data.save();
  });
}




Aucun commentaire:

Enregistrer un commentaire