2021-10-19 08:31:51 +00:00
|
|
|
import { api_call, API_URL } from "./util";
|
2021-10-18 15:32:20 +00:00
|
|
|
|
2021-10-19 07:47:51 +00:00
|
|
|
const planetes = document.getElementById("resultats");
|
|
|
|
|
2021-10-18 15:32:20 +00:00
|
|
|
console.log('planet.js loaded');
|
|
|
|
|
2021-10-19 08:31:51 +00:00
|
|
|
api_call(API_URL + "/planets", console.log);
|
2021-10-18 15:32:20 +00:00
|
|
|
|
|
|
|
|
2021-10-19 08:31:51 +00:00
|
|
|
function remplissage(results){
|
|
|
|
|
|
|
|
const previousUrl = results.previous;
|
|
|
|
const nextUrl = results.next;
|
|
|
|
const tabResults = results.results;
|
|
|
|
|
|
|
|
for(resultPlanet of tabResults){
|
|
|
|
const nom = resultPlanet.name;
|
|
|
|
const diametre = resultPlanet.diameter;
|
|
|
|
const climate = resultPlanet.climate;
|
|
|
|
const terrain = resultPlanet.terrain;
|
|
|
|
const population = resultPlanet.population;
|
|
|
|
|
|
|
|
// const tabResidents = resultPLanet.residents;
|
|
|
|
// const tabResidents = call_api(`people/`);
|
|
|
|
const tabFilms = resultPLanet.films;
|
|
|
|
|
|
|
|
}
|
2021-10-19 07:47:51 +00:00
|
|
|
|
|
|
|
|
|
|
|
planetes.innerHTML =
|
|
|
|
`<section class="resultat">
|
|
|
|
<h1 class="titreAccordeon"></h1>
|
|
|
|
<div class="accordeon">
|
|
|
|
<div class="1">Prout 1</div>
|
|
|
|
<div class="2">Prout 2</div>
|
|
|
|
<div class="3">Prout 3</div>
|
|
|
|
</div>
|
|
|
|
</section>`;
|
|
|
|
}
|
|
|
|
|
2021-10-19 08:31:51 +00:00
|
|
|
// api_call(API_URL + "/planets", remplissage);
|