fix: use shared auth-guard.js on settings.html

This commit is contained in:
Zac Gaetano 2026-05-18 13:25:03 -04:00
parent ebe8b3be59
commit a40232e2b5

View file

@ -291,24 +291,6 @@
el.textContent = msg;
}
</script>
<script>
(async () => {
try {
const r = await fetch('/api/v1/auth/me', { credentials: 'include' });
if (r.ok) {
const u = await r.json();
const name = u.display_name || u.username || 'User';
document.getElementById('userName').textContent = name;
document.getElementById('userAvatar').textContent = name[0].toUpperCase();
const roleEl = document.getElementById('userRole');
if (roleEl) roleEl.textContent = u.role || '';
}
} catch (_) {}
document.getElementById('logoutBtn').onclick = async () => {
try { await fetch('/api/v1/auth/logout', { method: 'POST', credentials: 'include' }); } catch (_) {}
location.href = 'login.html';
};
})();
</script>
<script src="js/auth-guard.js"></script>
</body>
</html>