jeudi 17 janvier 2019

How to send addicional information along with ember Delete model request

I have an ember model that I want to delete. So, according to the documentation I could do any of the following:

store.findRecord('post', 1, { backgroundReload: false }).then(function(post) {
        post.deleteRecord();
        post.get('isDeleted'); // => true
        post.save(); // => DELETE to /posts/1
    });

OR

store.findRecord('post', 2, { backgroundReload: false }).then(function(post) 
{
  post.destroyRecord(); // => DELETE to /posts/2
});

But, let's say that in order to delete the post model I need addicional information. For exemple, I also want to know the 'idAplication' (aplication sending delete request) and 'userEmail' (user trying to delete post).

The problem is: by default the ember store will only send me the post id: myapi.com/posts/1

How can I do this ? How to send something else with the body delete request using ember model ?




Aucun commentaire:

Enregistrer un commentaire