feat: redirect to home after logout (header and account)
This commit is contained in:
parent
d296b7aa72
commit
af5b4afebf
@ -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>) {
|
||||||
|
|||||||
@ -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";
|
||||||
}
|
}
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user