diff --git a/frontend/js/config.js b/frontend/js/config.js index 7e4b7b1..5bd62fc 100644 --- a/frontend/js/config.js +++ b/frontend/js/config.js @@ -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(); }); } -}