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));