fix: linking is broken

This commit is contained in:
dvelo 2025-01-17 21:54:51 -06:00 committed by GitHub
commit 0eef4ed4f6
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

@ -83,15 +83,20 @@ export default function CodeDialog({
}); });
async function onSubmit(data: z.infer<typeof FormSchema>) { async function onSubmit(data: z.infer<typeof FormSchema>) {
const { code } = data; const { code } = data;
const playerName = await toast.promise( toast.promise(
new Promise(async (g, b) => { new Promise<void>((g, b) => {
const response = await linkMCAccount(code); linkMCAccount(code).then((c) => {
console.log(c);
if (c === undefined) {
b();
return;
}
g();
if (response == undefined) { setName(c);
b(); setDialog(true);
return; setLinked(true);
} });
g(response);
}), }),
{ {
loading: "Linking account..", loading: "Linking account..",
@ -99,9 +104,6 @@ export default function CodeDialog({
success: "Linked account!", success: "Linked account!",
} }
); );
setName(playerName as string);
setDialog(true);
setLinked(true);
} }
return ( return (
@ -156,9 +158,9 @@ export default function CodeDialog({
<DialogTitle>You have linked your account!</DialogTitle> <DialogTitle>You have linked your account!</DialogTitle>
<Confetti className="absolute left-0 top-0 z-0 size-full" /> <Confetti className="absolute left-0 top-0 z-0 size-full" />
<DialogDescription> <DialogDescription>
You've successfully linked your account, <strong>{name}</strong>! You've successfully linked your account, {name}! Enjoy adding
Enjoy adding banners, custom accent colors, and other things to banners, custom accent colors, and other things to your server
your server page. page.
</DialogDescription> </DialogDescription>
</DialogHeader> </DialogHeader>
</DialogContent> </DialogContent>