mirror of
https://github.com/arthur-pbty/streaming-site.git
synced 2026-06-03 15:07:38 +02:00
23 lines
625 B
JavaScript
23 lines
625 B
JavaScript
document.addEventListener('DOMContentLoaded', () => {
|
|
const token = localStorage.getItem('token');
|
|
|
|
if (!token) {
|
|
alert('Vous devez être connecté pour accéder à votre profil.');
|
|
window.location.href = 'login.html';
|
|
return;
|
|
}
|
|
|
|
fetch('/profile', {
|
|
headers: {
|
|
'Authorization': token
|
|
}
|
|
})
|
|
.then(response => response.json())
|
|
.then(user => {
|
|
const profileDetails = document.getElementById('profile-details');
|
|
profileDetails.innerHTML = `
|
|
<h2>Profil de ${user.email}</h2>
|
|
<p>Status: ${user.status}</p>
|
|
`;
|
|
});
|
|
}); |