tp 1b fin
This commit is contained in:
@@ -6,14 +6,15 @@
|
||||
|
||||
const teamsDiv = document.getElementById('teams');
|
||||
function fetchTeams() {
|
||||
fetch('http://127.0.0.1:9090/equipes')
|
||||
fetch('http://127.0.0.1:9090/api/teams')
|
||||
.then((response) => {
|
||||
response.json()
|
||||
.then((teams) => {
|
||||
const mmoContent = teams.equipes.map((team) =>
|
||||
`<div>${team.name} - ${team.id}</div>`
|
||||
).join('');
|
||||
teamsDiv.innerHTML = mmoContent;
|
||||
let div = "";
|
||||
teams.forEach((t) => {
|
||||
div += `<div>Equipe ID${t.id} - Nom d'équipe ${t.team}</div>\n`
|
||||
})
|
||||
teamsDiv.innerHTML = div;
|
||||
})
|
||||
}).catch(error => console.error);
|
||||
}
|
||||
|
Reference in New Issue
Block a user