customer-presentation/protected/archive.js
2026-04-22 14:39:16 +02:00

15 lines
892 B
JavaScript

// ─────────────────────────────────────────────────────────────
// protected/archive.js — client-side behaviour for the archive page.
// Served from /archive/archive.js, gated by requireAuth like the
// rest of the protected directory.
// ─────────────────────────────────────────────────────────────
document.getElementById('logout').addEventListener('click', async () => {
try {
await fetch('/auth/logout', { method: 'POST', credentials: 'same-origin' });
} catch (err) {
// Even if the fetch fails, sending them to / will prompt a fresh login
console.warn('logout request failed', err);
}
window.location.href = '/';
});