mirror of
https://github.com/monkeytypegame/monkeytype.git
synced 2024-11-10 17:04:49 +08:00
fix some backend errors (#2580)
This commit is contained in:
parent
9d522d0c37
commit
8620b45ea7
2 changed files with 6 additions and 6 deletions
|
@ -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,
|
||||
|
|
|
@ -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;
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue