fix: use shared auth-guard.js on upload.html
This commit is contained in:
parent
a40232e2b5
commit
d8766f18cc
1 changed files with 1 additions and 19 deletions
|
|
@ -480,24 +480,6 @@
|
|||
return (bytes/1024/1024/1024).toFixed(2) + ' GB';
|
||||
}
|
||||
</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>
|
||||
|
|
|
|||
Loading…
Reference in a new issue