mirror of
https://github.com/Sendouc/sendou.ink.git
synced 2026-09-13 14:46:10 -05:00
promise race in backend
This commit is contained in:
1
react-ui/src/components/common/BuildCard.js
vendored
1
react-ui/src/components/common/BuildCard.js
vendored
@@ -78,6 +78,7 @@ const BuildCard = ({
|
||||
{build.description && showDescription && (
|
||||
<Popup
|
||||
content={buildDescription}
|
||||
style={{ whiteSpace: "pre-wrap" }}
|
||||
trigger={
|
||||
<Icon
|
||||
style={{ marginLeft: "0.25em" }}
|
||||
|
||||
@@ -144,12 +144,14 @@ const resolvers = {
|
||||
|
||||
const faPost = new FAPost({ ...args, discord_id: ctx.user.discord_id })
|
||||
args.user = ctx.user
|
||||
await Promise.all([faPost.save(), sendFAPostToDiscord(args)]).catch(e => {
|
||||
throw (new UserInputError(),
|
||||
{
|
||||
invalidArgs: args,
|
||||
})
|
||||
})
|
||||
await Promise.race([faPost.save(), sendFAPostToDiscord(args)]).catch(
|
||||
e => {
|
||||
throw (new UserInputError(),
|
||||
{
|
||||
invalidArgs: args,
|
||||
})
|
||||
}
|
||||
)
|
||||
|
||||
return true
|
||||
},
|
||||
|
||||
@@ -51,7 +51,7 @@ function sendFAPostToDiscord(args) {
|
||||
)
|
||||
}
|
||||
|
||||
return () => Hook.send(msg)
|
||||
return Hook.send(msg)
|
||||
}
|
||||
|
||||
module.exports = sendFAPostToDiscord
|
||||
|
||||
Reference in New Issue
Block a user