fix: both logout buttons now use inline onclick — no JS handlers
- Header #logout-btn: inline fetch+clear localStorage+redirect - Settings #profile-logout: inline window.handleLogout or fetch fallback - Removed all JS event listeners that were causing race conditions - Zero dependency on ES module loading order
This commit is contained in:
@@ -661,6 +661,7 @@
|
|||||||
id="logout-btn"
|
id="logout-btn"
|
||||||
type="button"
|
type="button"
|
||||||
role="menuitem"
|
role="menuitem"
|
||||||
|
onclick="fetch('/api/auth/logout',{method:'POST',credentials:'include'}).then(function(){localStorage.clear();window.location.href='/'}).catch(function(){localStorage.clear();window.location.href='/'})"
|
||||||
>
|
>
|
||||||
<span
|
<span
|
||||||
class="menu-list-icon"
|
class="menu-list-icon"
|
||||||
|
|||||||
+1
-1
@@ -207,7 +207,7 @@ const AuthManager = {
|
|||||||
safeCreateIcons();
|
safeCreateIcons();
|
||||||
|
|
||||||
const logoutBtn = document.getElementById("logout-btn");
|
const logoutBtn = document.getElementById("logout-btn");
|
||||||
if (logoutBtn) logoutBtn.addEventListener("click", () => AuthManager.logout());
|
// Logout button — handled inline in index.html
|
||||||
|
|
||||||
const adminRow = document.getElementById("admin-menu-row");
|
const adminRow = document.getElementById("admin-menu-row");
|
||||||
if (adminRow) {
|
if (adminRow) {
|
||||||
|
|||||||
Reference in New Issue
Block a user