added ban redirect correctly
All checks were successful
Build Frontend / Build Frontend (push) Successful in 17s
All checks were successful
Build Frontend / Build Frontend (push) Successful in 17s
This commit is contained in:
@@ -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;
|
||||
|
||||
Reference in New Issue
Block a user