fix: header logout button dynamically recreated by renderUserMenu
- renderUserMenu() rebuilds #logout-btn with innerHTML, wiping inline onclick - Added onclick='window.handleLogout()' to the dynamic innerHTML string - Restored addEventListener as double safety - Settings #profile-logout already has onclick to handleLogout
This commit is contained in:
+2
-2
@@ -203,11 +203,11 @@ const AuthManager = {
|
|||||||
userMenu.innerHTML = "";
|
userMenu.innerHTML = "";
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
userMenu.innerHTML = '<span class="user-display-name">' + (user.display_name || user.username) + "</span>" + '<button class="btn-logout" id="logout-btn" title="' + t('auth.logout_title') + '"><i data-lucide="log-out" style="width:14px;height:14px"></i></button>';
|
userMenu.innerHTML = '<span class="user-display-name">' + (user.display_name || user.username) + "</span>" + '<button class="btn-logout" id="logout-btn" title="' + t('auth.logout_title') + '" onclick="window.handleLogout()"><i data-lucide="log-out" style="width:14px;height:14px"></i></button>';
|
||||||
safeCreateIcons();
|
safeCreateIcons();
|
||||||
|
|
||||||
const logoutBtn = document.getElementById("logout-btn");
|
const logoutBtn = document.getElementById("logout-btn");
|
||||||
// Logout button — handled inline in index.html
|
if (logoutBtn) logoutBtn.addEventListener("click", () => AuthManager.logout());
|
||||||
|
|
||||||
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