From 8620b45ea779a4bd0a4573cf7b6cccff076c051c Mon Sep 17 00:00:00 2001 From: Ferotiq <64989416+Ferotiq@users.noreply.github.com> Date: Wed, 23 Feb 2022 21:54:38 -0600 Subject: [PATCH] fix some backend errors (#2580) --- backend/api/controllers/user.js | 6 +++--- backend/handlers/captcha.js | 6 +++--- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/backend/api/controllers/user.js b/backend/api/controllers/user.js index 0001d1085..7f34eb3dd 100644 --- a/backend/api/controllers/user.js +++ b/backend/api/controllers/user.js @@ -139,13 +139,13 @@ class UserController { throw new MonkeyError(403, "Banned accounts cannot link with Discord"); } - let discordFetch = await fetch("https://discord.com/api/users/@me", { + const discordFetch = await fetch("https://discord.com/api/users/@me", { headers: { authorization: `${req.body.data.tokenType} ${req.body.data.accessToken}`, }, }); - discordFetch = await discordFetch.json(); - const did = discordFetch.id; + const discordFetchJSON = await discordFetch.json(); + const did = discordFetchJSON.id; if (!did) { throw new MonkeyError( 500, diff --git a/backend/handlers/captcha.js b/backend/handlers/captcha.js index c50a9565b..5d5f689a9 100644 --- a/backend/handlers/captcha.js +++ b/backend/handlers/captcha.js @@ -3,7 +3,7 @@ import "dotenv/config"; export async function verify(captcha) { if (process.env.MODE === "dev") return true; - let response = await fetch( + const response = await fetch( `https://www.google.com/recaptcha/api/siteverify`, { method: "POST", @@ -11,6 +11,6 @@ export async function verify(captcha) { body: `secret=${process.env.RECAPTCHA_SECRET}&response=${captcha}`, } ); - response = await response.json(); - return response?.success; + const responseJSON = await response.json(); + return responseJSON?.success; }