fix: settings logout buttons now call AuthManager.logout() directly

- Replaced window.handleLogout indirection with direct AuthManager.logout() call
- config.js already imports AuthManager from auth.js — no race condition
- Same direct call as header button (auth.js line 210)
This commit is contained in:
2026-07-24 09:50:15 -04:00
parent 3655ef8a7e
commit b46b98c5a7
+4 -15
View File
@@ -631,16 +631,11 @@ function initConfigModal() {
}); });
} }
// Logout button (always visible) — delegates to global handleLogout (no confirm) // Logout button (always visible) — calls AuthManager.logout() directly
var logoutBtn = document.getElementById("logout-btn"); var logoutBtn = document.getElementById("logout-btn");
if (logoutBtn) { if (logoutBtn) {
logoutBtn.addEventListener("click", function() { logoutBtn.addEventListener("click", function() {
if (typeof window.handleLogout === 'function') { AuthManager.logout();
window.handleLogout();
} else {
fetch('/api/auth/logout', { method: 'POST', credentials: 'include' })
.finally(function() { window.location.href = '/'; });
}
}); });
} }
@@ -1577,15 +1572,9 @@ function initProfile() {
} catch(e) {} } catch(e) {}
}); });
// Logout button — delegates to global handleLogout (no confirm) // Logout button — calls AuthManager.logout() directly
if (logoutBtn) { if (logoutBtn) {
logoutBtn.addEventListener('click', function() { logoutBtn.addEventListener('click', function() {
if (typeof window.handleLogout === 'function') { AuthManager.logout();
window.handleLogout();
} else {
fetch('/api/auth/logout', { method: 'POST', credentials: 'include' })
.finally(function() { window.location.href = '/'; });
}
}); });
} }
}