diff --git a/src/trx-client/trx-frontend/trx-frontend-http/assets/web/app.js b/src/trx-client/trx-frontend/trx-frontend-http/assets/web/app.js index 1fa03c6..c86747e 100644 --- a/src/trx-client/trx-frontend/trx-frontend-http/assets/web/app.js +++ b/src/trx-client/trx-frontend/trx-frontend-http/assets/web/app.js @@ -48,9 +48,14 @@ async function authLogout() { const resp = await fetch("/auth/logout", { method: "POST" }); if (!resp.ok) throw new Error("Logout failed"); authRole = null; - location.reload(); + // Disconnect and show auth gate without page reload + disconnect(); + document.getElementById("content").style.display = "none"; + updateAuthUI(); + showAuthGate(false); } catch (e) { console.error("Logout failed:", e); + showAuthError("Logout failed"); } } @@ -909,6 +914,27 @@ function connect() { }, 5000); } +function disconnect() { + // Close event sources + if (es) { + es.close(); + es = null; + } + if (decodeSource) { + decodeSource.close(); + decodeSource = null; + } + // Clear timers + if (esHeartbeat) { + clearInterval(esHeartbeat); + esHeartbeat = null; + } + if (reconnectTimer) { + clearTimeout(reconnectTimer); + reconnectTimer = null; + } +} + async function postPath(path) { const resp = await fetch(path, { method: "POST" }); if (resp.status === 401 || resp.status === 403) {