2023-03-24 11:27:20 +01:00

28 lines
806 B
HTML

<html>
<h1>List of teams:</h1>
<div id="teams"></div>
<script>
const teamsDiv = document.getElementById('teams');
function fetchTeams() {
fetch('http://127.0.0.1:9090/api/teams')
.then((response) => {
response.json()
.then((teams) => {
let div = "";
teams.forEach((t) => {
div += `<div>Equipe ID${t.id} - Nom d'équipe ${t.team}</div>\n`
div += `<ul>`
t.members.forEach((m) => {
div += `<li>${m.name}</li>`
})
div += `</ul>`
})
teamsDiv.innerHTML = div;
})
}).catch(error => console.error);
}
fetchTeams();
</script>
</html>