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:
+4
-15
@@ -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");
|
||||
if (logoutBtn) {
|
||||
logoutBtn.addEventListener("click", function() {
|
||||
if (typeof window.handleLogout === 'function') {
|
||||
window.handleLogout();
|
||||
} else {
|
||||
fetch('/api/auth/logout', { method: 'POST', credentials: 'include' })
|
||||
.finally(function() { window.location.href = '/'; });
|
||||
}
|
||||
AuthManager.logout();
|
||||
});
|
||||
}
|
||||
|
||||
@@ -1577,15 +1572,9 @@ function initProfile() {
|
||||
} catch(e) {}
|
||||
});
|
||||
|
||||
// Logout button — delegates to global handleLogout (no confirm)
|
||||
// Logout button — calls AuthManager.logout() directly
|
||||
if (logoutBtn) {
|
||||
logoutBtn.addEventListener('click', function() {
|
||||
if (typeof window.handleLogout === 'function') {
|
||||
window.handleLogout();
|
||||
} else {
|
||||
fetch('/api/auth/logout', { method: 'POST', credentials: 'include' })
|
||||
.finally(function() { window.location.href = '/'; });
|
||||
}
|
||||
AuthManager.logout();
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user