fix: Update Discord login handling to use async/await for better error handling
All checks were successful
SteamWarCI Build successful

This commit is contained in:
2025-11-15 00:06:13 +01:00
parent f503d59eeb
commit 64adfe7c3b
2 changed files with 11 additions and 7 deletions

View File

@@ -59,14 +59,16 @@
const accessToken = params.get("access_token");
if (accessToken) {
let auth = $authV2Repo.loginDiscord(accessToken);
if (!auth) {
pw = "";
error = t("login.error");
return;
}
(async () => {
let auth = await $authV2Repo.loginDiscord(accessToken);
if (!auth) {
pw = "";
error = t("login.error");
return;
}
navigate(l("/dashboard"));
navigate(l("/dashboard"));
})();
}
}
});

View File

@@ -25,6 +25,8 @@ export class AuthV2Repo {
this.request("/data/me").then((value) => {
if (value.ok) {
loggedIn.set(true);
} else {
loggedIn.set(false);
}
});
}