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() {
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>) {

View File

@ -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";
}