fix some backend errors (#2580)

This commit is contained in:
Ferotiq 2022-02-23 21:54:38 -06:00 committed by GitHub
parent 9d522d0c37
commit 8620b45ea7
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 6 additions and 6 deletions

View file

@ -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,

View file

@ -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;
}