diff --git a/scripts/planets.js b/scripts/planets.js index 8a6227c..40463ca 100644 --- a/scripts/planets.js +++ b/scripts/planets.js @@ -6,6 +6,8 @@ console.log('planet.js loaded'); function remplissage(results){ + planetes.innerHTML = ""; + const previousUrl = results.previous; const nextUrl = results.next; const tabResults = results.results; @@ -17,7 +19,7 @@ function remplissage(results){ const terrain = resultPlanet.terrain; const population = resultPlanet.population; - const tabResidents = resultPLanet.residents; + const tabResidents = resultPlanet.residents; //Problème de requêtes asyncrones // let tabResidents = []; // for(index in resultPlanet.residents){ @@ -29,18 +31,24 @@ function remplissage(results){ // console.log(`nom des résidents : ${tabResidents}`); const tabFilms = resultPlanet.films; + + planetes.innerHTML += + `
+

${nom}

+
+
+

${terrain}

+

${climate}

+

${diametre}Km

+
+
${tabResidents}
+
${tabFilms}
+
+
`; } + //Pagination - planetes.innerHTML = - `
-

-
-
Prout 1
-
Prout 2
-
Prout 3
-
-
`; } api_call(API_URL + "/planets", remplissage); \ No newline at end of file