Merge branch 'dev' into films

This commit is contained in:
rasoirnoir 2021-10-18 20:08:06 +02:00
commit 951d701a8e
No known key found for this signature in database
GPG key ID: 995E4575ADB981A3
17 changed files with 15772 additions and 15813 deletions

7
scripts/planets.js Normal file
View file

@ -0,0 +1,7 @@
import { api_call } from "./util";
console.log('planet.js loaded');
api_call("planets", console.log);

View file

@ -7,7 +7,7 @@ const URL = "https://swapi.dev/api";
* @param {string} endpoint l'endpoint à interroger (ex: planets)
* @param {function} callback La fonction qui traitera la réponse JSON en retour
*/
const api_call = (endpoint, callback) => {
export const api_call = (endpoint, callback) => {
fetch(`${URL}/${endpoint}`)
.then(response => {
return response.json();
@ -15,4 +15,5 @@ const api_call = (endpoint, callback) => {
.then(jsonResp => {
callback(jsonResp);
});
}
}