Wednesday 28 December 2016

[FeathersJS] How do I access an object in its before remove hook?

I want to access data from an object before actually removing it from the database. Problem is the data attribute doesn’t exist in my hook, it only seems to exist in create, update and patch (like it’s stated in the docs).I tried using a get in the before hook, but that doesn’t seem to do anything, it does the console log so the code should be reached:console.log(“I’m in the before hook on remove”); app.service('products').get(hook.id).then(product => console.log(product)); But the second line doesn’t seem to do anything at all. I want to access some data of my product object before removing it, more specifically the image name so I can remove its images and thumbnails in their directories.Any help? Am I doing something wrong or is there a better solution for it? Thanks in advance.

Submitted December 28, 2016 at 07:20PM by De_Wouter

No comments:

Post a Comment