From f9d0bfd3a3ee0eaeb50d0b25cb9de3a03eda2203 Mon Sep 17 00:00:00 2001 From: Markov Date: Tue, 24 Feb 2026 09:38:31 +0100 Subject: [PATCH] fix: auto-logout on WS auth.error (forces re-login with valid JWT) --- src/lib/ws.ts | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/src/lib/ws.ts b/src/lib/ws.ts index 116040b..b1cf871 100644 --- a/src/lib/ws.ts +++ b/src/lib/ws.ts @@ -51,6 +51,14 @@ class WSClient { this.pendingQueue = []; } + // Auth error → force re-login + if (type === "auth.error") { + console.error("WS auth failed:", msg); + localStorage.removeItem("tb_token"); + window.location.href = "/login"; + return; + } + // Dispatch to handlers const fns = this.handlers.get(type); if (fns) fns.forEach((fn) => fn(msg.data || msg));