diff --git a/src/components/misc/LinkDialog.tsx b/src/components/misc/LinkDialog.tsx index 36a3892..875418e 100644 --- a/src/components/misc/LinkDialog.tsx +++ b/src/components/misc/LinkDialog.tsx @@ -83,15 +83,20 @@ export default function CodeDialog({ }); async function onSubmit(data: z.infer) { const { code } = data; - const playerName = await toast.promise( - new Promise(async (g, b) => { - const response = await linkMCAccount(code); + toast.promise( + new Promise((g, b) => { + linkMCAccount(code).then((c) => { + console.log(c); + if (c === undefined) { + b(); + return; + } + g(); - if (response == undefined) { - b(); - return; - } - g(response); + setName(c); + setDialog(true); + setLinked(true); + }); }), { loading: "Linking account..", @@ -99,9 +104,6 @@ export default function CodeDialog({ success: "Linked account!", } ); - setName(playerName as string); - setDialog(true); - setLinked(true); } return ( @@ -156,9 +158,9 @@ export default function CodeDialog({ You have linked your account! - You've successfully linked your account, {name}! - Enjoy adding banners, custom accent colors, and other things to - your server page. + You've successfully linked your account, {name}! Enjoy adding + banners, custom accent colors, and other things to your server + page.