Fix type assertions in Discord callback

cgen-716ea5b936c24ad699a03be069e0afda
This commit is contained in:
Builder.io 2025-11-16 07:07:19 +00:00
parent 990cdb459a
commit bed085f1ea

View file

@ -146,7 +146,7 @@ export default async function handler(req: any, res: any) {
return res.redirect("/login?error=token_exchange");
}
const tokenData: DiscordTokenResponse = await tokenResponse.json();
const tokenData = (await tokenResponse.json()) as DiscordTokenResponse;
// Fetch Discord user profile
const userResponse = await fetch("https://discord.com/api/v10/users/@me", {
@ -160,7 +160,7 @@ export default async function handler(req: any, res: any) {
return res.redirect("/login?error=user_fetch");
}
const discordUser: DiscordUser = await userResponse.json();
const discordUser = (await userResponse.json()) as DiscordUser;
// Validate Discord user has email
if (!discordUser.email) {