Here is the code I have:
async.auto({
client: service.findClient,
existingChat: ['client', service.findChat],
chat: ['client', 'existingChat', service.createChat]
}, (err) => {
if (err) return service.handleError(err);
service.emitChatEvent();
service.editMenu();
});
What is the best way to handle it by using Bluebird Promises?
The most confusing thing to me is this line:
chat: ['client', 'existingChat', service.createChat]
service.createChat
should have an access to both service.findClient()
and service.findChat()
results.