// ───────────────────────────────────────────────────────────── // 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 = '/'; });