From add103dba7541125704f58a410667a8d5c7fefd8 Mon Sep 17 00:00:00 2001 From: "Builder.io" Date: Mon, 10 Nov 2025 21:44:54 +0000 Subject: [PATCH] completionId: cgen-7bceb9648c614d08a5df40118162c8a0 cgen-7bceb9648c614d08a5df40118162c8a0 --- api/discord/verify-code.ts | 14 ++++++-------- 1 file changed, 6 insertions(+), 8 deletions(-) diff --git a/api/discord/verify-code.ts b/api/discord/verify-code.ts index c7404987..18ed4a1b 100644 --- a/api/discord/verify-code.ts +++ b/api/discord/verify-code.ts @@ -89,24 +89,22 @@ export default async function handler(req: any, res: any) { } // Delete used verification code - await supabase + const { error: deleteError } = await supabase .from("discord_verifications") .delete() .eq("verification_code", verification_code.trim()); - // Fetch Discord user info from verification for response - const { data: discordUser } = await supabase - .from("discord_verifications") - .select("*") - .eq("discord_id", discordId) - .maybeSingle(); + if (deleteError) { + console.error("[Discord Verify] Failed to delete verification code:", deleteError); + // Don't return error - code is already used and link is created + } res.status(200).json({ success: true, message: "Discord account linked successfully!", discord_user: { id: discordId, - username: discordUser?.username || "Discord User", + username: verification.username || "Discord User", discriminator: "0000", }, });