// users.hooks.js
const userDeletion = require('../userdeletion/userDeletion');
const triggerUserDeletion = () => {
return async (context) => {
const userDeletionRes = userDeletion(context);
const userDeletionResRes = userDeletionRes(context);
await Promise.all(
[userDeletionResRes]
);
};
};
// userDeletion.js
module.exports = () => {
return async (context) => {
const userDeletionResult = await context.app.service('replicate').remove(
{
// ...
}
);
const userDeletionResultData = userDeletionResult.data[0];
console.log(userDeletionResultData);
};
};
Here is my custom hook implementation. How can I properly wait for the response of 2 separate services instead of just one?