using promise all in addFreeAgentPost resolver

This commit is contained in:
Sendou 2019-12-15 16:51:00 +02:00
parent 1752fb64c7
commit 3eb635bb2e
2 changed files with 3 additions and 5 deletions

View File

@ -143,16 +143,14 @@ const resolvers = {
}
const faPost = new FAPost({ ...args, discord_id: ctx.user.discord_id })
await faPost.save().catch(e => {
args.user = ctx.user
await Promise.all([faPost.save(), sendFAPostToDiscord(args)]).catch(e => {
throw (new UserInputError(),
{
invalidArgs: args,
})
})
args.user = ctx.user
sendFAPostToDiscord(args)
return true
},
updateFreeAgentPost: async (root, args, ctx) => {

View File

@ -51,7 +51,7 @@ function sendFAPostToDiscord(args) {
)
}
return Hook.send(msg)
return () => Hook.send(msg)
}
module.exports = sendFAPostToDiscord