I want to sync the data from the wix site to another system.
For this I decided to use the afterUpdate data-hook on required collection.
Since the code involved REST api calls I have used a promise which resolves to the same item it got after the API calls.
Now the API calls do work but for some reason the promise is not resolving in the hook and keep getting error cannot read property _id of undefined
Since there is no example code on Promise based data hook in the reference docs I am unable to proceed.
Can someone provide me an example of how to use Promises in the data hook?
https://support.wix.com/en/article/corvid-working-with-promises
https://www.wix.com/code/home/forum/community-discussion/working-with-promises
https://www.wix.com/code/home/forum/wix-tips-and-updates/promises-promises
https://www.wix.com/corvid/reference/wix-data.Hooks.html
https://www.wix.com/corvid/reference/wix-fetch.html