mercredi 6 juin 2018

Deleting an item in ember mirage fixture but it is still displayed in ember template

I have a template that displays a list of items from a fixture i defined in ember cli mirage. Each item has a delete option. The request to delete is processed by:

mirage.config.js

this.del('/survey-groups/:id', ({ surveyGroups }, request) => {
let id = request.params.id;

surveyGroups.findBy({keyId: id}).destroy();

});

This returns a 204 status and empty object in the console but the item is still displayed in the template. Is there anyway to remove the item from the template when the delete option is selected. I know it isn't really deleted from the fixture but just for that moment, is there a way to mock it's removal in the template as well.




Aucun commentaire:

Enregistrer un commentaire