summary refs log tree commit diff
path: root/api
diff options
context:
space:
mode:
authorKuna <65683493+Thesourtimes@users.noreply.github.com>2021-12-07 19:39:03 +0300
committerGitHub <noreply@github.com>2021-12-07 19:39:03 +0300
commit9e4589503163e8f82788033c439869dc4acc282f (patch)
tree434e86632de189d27b1517e62e86a295e8a4acd6 /api
parentFix previous commit (diff)
downloadserver-9e4589503163e8f82788033c439869dc4acc282f.tar.xz
Update index.ts
Diffstat (limited to 'api')
-rw-r--r--api/src/routes/invites/index.ts3
1 files changed, 2 insertions, 1 deletions
diff --git a/api/src/routes/invites/index.ts b/api/src/routes/invites/index.ts
index a9ec2421..a237ea90 100644
--- a/api/src/routes/invites/index.ts
+++ b/api/src/routes/invites/index.ts
@@ -15,7 +15,8 @@ router.get("/:code", route({}), async (req: Request, res: Response) => {
 
 router.post("/:code", route({}), async (req: Request, res: Response) => {
 	const { code } = req.params;
-	const { features } = await Guild.findOneOrFail({ id: (await Invite.findOneOrFail({ code })).guild_id});
+        const { guild_id } = await Invite.findOneOrFail({ code })
+	const { features } = await Guild.findOneOrFail({ id: guild_id});
 	const { public_flags } = await User.findOneOrFail({ id: req.user_id });
 	
 	if(features.includes("INTERNAL_EMPLOYEE_ONLY") && (public_flags & 1) !== 1) throw new HTTPError("You are not allowed to join this guild.", 401)