I'm making a site for my game server, and I'm trying to display user information using the Steam API.
$.getJSON('/steamapi', function(data) {
document.getElementById("staff-inner").innerHTML = `${data.response.players.map(function(player) {
return `
<div class="player player-${player.steamid}">
<div class="name">${player.personaname}</div>
<div class="avatar"><img src="${player.avatarfull}"></div>
<div class="role"></div>
</div>
`;
}).join('')}`;
});
The above code is working fine. But, what I'm trying to do (and I assume this is the best way) is create an if statement that says if ${player.steamid} is my Steam ID, it prints 'Owner' in .role, and prints 'Moderator' if it's anything else. Seems like it would be simple enough, but everything I try leaves me with a blank page. I have no idea how or where I would write it in this context.