Files
info-user/server/static/app.js
T

20 lines
594 B
JavaScript

function escapeHtml(text) {
if (text == null) return '';
return text.toString()
.replace(/&/g, '&')
.replace(/</g, '&lt;')
.replace(/>/g, '&gt;')
.replace(/"/g, '&quot;');
}
document.addEventListener('DOMContentLoaded', () => {
const logout = document.getElementById('logout-link');
if (logout) {
logout.addEventListener('click', async (e) => {
e.preventDefault();
await fetch('/api/auth/logout', { method: 'POST', credentials: 'include' });
window.location.href = '/login';
});
}
});