This commit is contained in:
Mateusz Gruszczyński committed 2026-10-26 15:47:16 +01:00
1 parent f508b7c882
commit 25d04daaee
12 files changed
+323 -90

No files matched your search

+10 -1
View File
@@ -93,6 +93,11 @@ export async function setAuthSession(session) {
await setLanguage(session?.language || "en", { scope: "account" });
window.dispatchEvent(new CustomEvent("rustpad:session-change", { detail: { session } }));
}
export async function expireAuthSession() {
if (!getAuthToken()) return;
await clearAuthSession();
window.dispatchEvent(new CustomEvent("rustpad:session-expired"));
}
export async function clearAuthSession() {
localStorage.removeItem(AUTH_STATE_KEY);
localStorage.removeItem("rustpad:auth-token");
@@ -101,6 +106,10 @@ export async function clearAuthSession() {
sessionStorage.removeItem(NICKNAME_KEY);
setNicknameCookie("");
restoreGuestTheme();
await restoreGuestLanguage();
try {
await restoreGuestLanguage();
} catch {
// A language bundle failure must not block logout or session-expiry events.
}
window.dispatchEvent(new CustomEvent("rustpad:session-change", { detail: { session: null } }));
}