Ei vielä luotuja pelejä.
";
return;
}
gamesDiv.innerHTML = userGames.map(game => `
${game.title}
${game.description}
📊 ${game.total_posts || 0} postausta |
👥 ${game.player_count || 0} pelaajaa |
📖 ${game.chapter_count || 0} lukua
`).join("");
}
} catch (error) {
console.error("Error loading games:", error);
}
}
async function getUserProfile() {
try {
const response = await fetch(`/api/users/${userId}`, {
headers: {
"Authorization": `Bearer ${getCookie("token")}`
}
});
if (response.ok) {
return await response.json();
}
} catch (error) {
console.error("Error fetching user profile:", error);
}
return null;
}