28 lines
804 B
HTML
Raw Normal View History

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