From af5b4afebfdd53df87b6a26c42a2acf2733e9e7b Mon Sep 17 00:00:00 2001 From: flym Date: Sat, 12 Sep 2026 03:37:41 +0800 Subject: [PATCH] feat: redirect to home after logout (header and account) --- components/account-panel.tsx | 2 +- components/site-header.tsx | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/components/account-panel.tsx b/components/account-panel.tsx index a716e20..1086bfa 100644 --- a/components/account-panel.tsx +++ b/components/account-panel.tsx @@ -36,7 +36,7 @@ export function AccountPanel() { async function logout() { await fetch(`${apiBase}/auth/logout`, { method: "POST", credentials: "include", headers: { "X-CSRF-Token": csrf } }); - window.location.assign("/login"); + window.location.assign("/"); } async function changePassword(event: FormEvent) { diff --git a/components/site-header.tsx b/components/site-header.tsx index d6798c3..6b7b1e9 100644 --- a/components/site-header.tsx +++ b/components/site-header.tsx @@ -21,8 +21,8 @@ export function SiteHeader() { async function handleLogout() { try { await logout(); - setAuthed(false); - setOpen(false); + window.location.assign("/"); + return; } catch { window.location.href = "/login"; }