fix: auto-logout on WS auth.error (forces re-login with valid JWT)
This commit is contained in:
parent
3a2a32a50e
commit
f9d0bfd3a3
@ -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));
|
||||
|
||||
Loading…
Reference in New Issue
Block a user