added ban redirect correctly
All checks were successful
Build Frontend / Build Frontend (push) Successful in 17s

This commit is contained in:
2026-01-11 03:42:35 +00:00
parent aca0aca310
commit 5846541329
2 changed files with 49 additions and 0 deletions

View File

@@ -220,6 +220,28 @@ export const useWebSocketStore = defineStore("websocket", () => {
authStore.fetchUser();
break;
case "account_banned":
console.log("🔨 User account has been banned:", payload);
// Update the auth store - router guard will handle redirect
authStore.fetchUser().then(() => {
// Disconnect WebSocket since user is banned
disconnect();
// The router guard will automatically redirect to /banned page
// because authStore.isBanned will now be true
window.location.href = "/banned";
});
break;
case "account_unbanned":
console.log("✅ User account has been unbanned:", payload);
// Update the auth store to reflect unbanned status
authStore.fetchUser().then(() => {
// Redirect to home page
window.location.href = "/";
toast.success("Your account has been unbanned. Welcome back!");
});
break;
case "pong":
// Heartbeat response
break;