boucle qui fonctionne

This commit is contained in:
Blandine Bajard 2021-10-18 10:59:45 +02:00
parent 53adde4895
commit c10b0d39ce

View file

@ -16,17 +16,8 @@ fetch(API_URL)
.then(responsFormat => { .then(responsFormat => {
console.log(responsFormat); console.log(responsFormat);
for(let index = 0; index <6; index++){ for(let index = 0; index <6; index++){
NOM.innerText = responsFormat.data[0].last_name; console.log(responsFormat.data[index]);
PRENOM.innerText = responsFormat.data[0].first_name; const PERSONNE = responsFormat.data[index];
IDENTIFIANT.innerText = responsFormat.data[0].id;
EMAIL.innerText = responsFormat.data[0].email;
AVATAR.src = responsFormat.data[0].avatar;
}
for(let index = 0; index <6; index++){
console.log(data[0]);
console.log(data[index]);
const PERSONNE = responsFormat[data[0]];
console.log(PERSONNE); console.log(PERSONNE);
MEMBER.innerHTML +=` MEMBER.innerHTML +=`
@ -38,8 +29,19 @@ MEMBER.innerHTML +=`
<img src="${PERSONNE.avatar}" alt=""> <img src="${PERSONNE.avatar}" alt="">
</div> </div>
` `
/* NOM.innerText = responsFormat.data[0].last_name;
PRENOM.innerText = responsFormat.data[0].first_name;
IDENTIFIANT.innerText = responsFormat.data[0].id;
EMAIL.innerText = responsFormat.data[0].email;
AVATAR.src = responsFormat.data[0].avatar;*/
} }
})
}
)
.catch(err => { .catch(err => {