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");
|
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 = '/'; });
|
|
||||||
}
|
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|||||||
Reference in New Issue
Block a user