function markAllRead() { const token = document.querySelector('meta[name="api-token"]')?.getAttribute('content') || ''; const headers = { 'Accept': 'application/json' }; if (token) headers['Authorization'] = 'Bearer ' + token; fetch('/api/notifications/read-all', { method: 'POST', headers }) .then(r => r.json()) .then(d => { if (d.success) { document.querySelectorAll('.notif-item').forEach(function(el) { el.classList.remove('notif-unread'); el.classList.add('notif-read'); const dot = el.querySelector('.notif-dot'); if (dot) dot.remove(); }); location.reload(); } }) .catch(function(){}); }