🐛 fix: enhance logout functionality to support hash-based routing and improve redirect logic

This commit is contained in:
web
2025-12-16 06:25:38 -08:00
parent 56051b86bb
commit 69a89e0c39
2 changed files with 27 additions and 2 deletions
+10 -1
View File
@@ -59,9 +59,18 @@ export function setRedirectUrl(value?: string) {
export function Logout() {
if (!isBrowser()) return;
removeCookie("Authorization");
const pathname = location.pathname;
const hash = location.hash.slice(1);
if (!["", "/"].includes(pathname)) {
setRedirectUrl(location.pathname);
setRedirectUrl(pathname);
location.href = "/";
return;
}
if (hash && !["", "/"].includes(hash)) {
setRedirectUrl(hash);
location.href = "/";
}
}