feat: redirect to home after logout (header and account)

This commit is contained in:
flym 2026-09-12 03:37:41 +08:00
parent d296b7aa72
commit af5b4afebf
2 changed files with 3 additions and 3 deletions

View File

@ -36,7 +36,7 @@ export function AccountPanel() {
async function logout() { async function logout() {
await fetch(`${apiBase}/auth/logout`, { method: "POST", credentials: "include", headers: { "X-CSRF-Token": csrf } }); 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<HTMLFormElement>) { async function changePassword(event: FormEvent<HTMLFormElement>) {

View File

@ -21,8 +21,8 @@ export function SiteHeader() {
async function handleLogout() { async function handleLogout() {
try { try {
await logout(); await logout();
setAuthed(false); window.location.assign("/");
setOpen(false); return;
} catch { } catch {
window.location.href = "/login"; window.location.href = "/login";
} }