Skip to content

Commit

Permalink
Fixed user navbar + card style
Browse files Browse the repository at this point in the history
  • Loading branch information
GTK188 committed Jun 2, 2024
1 parent 4e0406c commit df79941
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 4 deletions.
1 change: 1 addition & 0 deletions static/css/style.css
Original file line number Diff line number Diff line change
Expand Up @@ -263,6 +263,7 @@ a {
.card-image img {
width: 90%;
height: auto;
max-width: 70%;
}

.card-image {
Expand Down
18 changes: 14 additions & 4 deletions static/js/displayName.js
Original file line number Diff line number Diff line change
Expand Up @@ -45,10 +45,20 @@ $(document).ready(function() {
const user = token ? parseJwt(token) : null;

if (user && user.user_id) {
$('#username').text(user.sub || 'John Doe'); // Affiche le nom d'utilisateur
$('#userwallet').text(user.wallet + '$'); // Affiche les informations de portefeuille
$('#user-link').attr("href", "#"); // Neutralise le lien si connecté
$('#logout-tooltip').show(); // Affiche l'icône de déconnexion
fetch("http://localhost:8000/user/private", {
credentials: "include",
}).then(value => {
if (!value.ok) {
alert(`Erreur lors de la récupération des cartes : ${value.status}`)
return
}
value.json().then(json => {
$('#username').text(user.sub || 'John Doe'); // Affiche le nom d'utilisateur
$('#userwallet').text(json.money + '$'); // Affiche les informations de portefeuille
$('#user-link').attr("href", "#"); // Neutralise le lien si connecté
$('#logout-tooltip').show(); // Affiche l'icône de déconnexion
})
})
} else {
$('#username').text('Login / Sign Up');
$('#userwallet').hide(); // Masque les informations de portefeuille
Expand Down

0 comments on commit df79941

Please sign in to comment.