fix: logout no longer reloads page, shows message instead
This commit is contained in:
@@ -148,8 +148,13 @@ async function init() {
|
||||
listEl.appendChild(a);
|
||||
});
|
||||
document.getElementById('logout-btn').onclick = async function(e) {
|
||||
await fetch('/api/v1/auth/logout', {method:'POST'});
|
||||
window.location.reload();
|
||||
e.preventDefault();
|
||||
e.stopPropagation();
|
||||
try {
|
||||
await fetch('/api/v1/auth/logout', {method:'POST'});
|
||||
} catch(_) {}
|
||||
el.innerHTML = '<p style="color:#060">Logged out. Session cleared.</p>';
|
||||
document.getElementById('logout-btn').style.display = 'none';
|
||||
};
|
||||
var hash = location.hash.slice(1);
|
||||
await loadDoc(hash || '01_auth');
|
||||
@@ -158,11 +163,6 @@ async function init() {
|
||||
}
|
||||
}
|
||||
|
||||
window.onpopstate = function() {
|
||||
var hash = location.hash.slice(1);
|
||||
if (hash) loadDoc(hash);
|
||||
};
|
||||
|
||||
init();
|
||||
</script>
|
||||
</body>
|
||||
|
||||
Reference in New Issue
Block a user