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>) {
const { code } = data;
const playerName = await toast.promise(
new Promise(async (g, b) => {
const response = await linkMCAccount(code);
if (response == undefined) {
toast.promise(
new Promise<void>((g, b) => {
linkMCAccount(code).then((c) => {
console.log(c);
if (c === undefined) {
b();
return;
}
g(response);
g();
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({
<DialogTitle>You have linked your account!</DialogTitle>
<Confetti className="absolute left-0 top-0 z-0 size-full" />
<DialogDescription>
You've successfully linked your account, <strong>{name}</strong>!
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.
</DialogDescription>
</DialogHeader>
</DialogContent>