diff --git a/schemas/fapost.js b/schemas/fapost.js index 8f8030525..a35ad3b47 100644 --- a/schemas/fapost.js +++ b/schemas/fapost.js @@ -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) => { diff --git a/utils/webhook.js b/utils/webhook.js index 72c477d13..40e146217 100644 --- a/utils/webhook.js +++ b/utils/webhook.js @@ -51,7 +51,7 @@ function sendFAPostToDiscord(args) { ) } - return Hook.send(msg) + return () => Hook.send(msg) } module.exports = sendFAPostToDiscord