-
Notifications
You must be signed in to change notification settings - Fork 562
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Filters: création des éléments de filtres, création des fonctions de …
…filtres, intégration au DOM
- Loading branch information
1 parent
3b36172
commit 38da376
Showing
4 changed files
with
64 additions
and
34 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,31 +1,31 @@ | ||
async function fetchWorks() { | ||
try { | ||
const response = await fetch("http://localhost:5678/api/works"); | ||
if (!response.ok) throw new Error("Problème avec la requête"); | ||
return await response.json(); | ||
} catch (error) { | ||
console.log(error); | ||
} | ||
} | ||
// async function fetchWorks() { | ||
// try { | ||
// const response = await fetch("http://localhost:5678/api/works"); | ||
// if (!response.ok) throw new Error("Problème avec la requête"); | ||
// return await response.json(); | ||
// } catch (error) { | ||
// console.log(error); | ||
// } | ||
// } | ||
|
||
fetchWorks().then((works) => { | ||
const sectionProjet = document.querySelector(".projets"); | ||
// fetchWorks().then((works) => { | ||
// const sectionProjet = document.querySelector(".projets"); | ||
|
||
works.forEach((projet) => { | ||
const projetFigure = document.createElement("figure"); | ||
// works.forEach((projet) => { | ||
// const projetFigure = document.createElement("figure"); | ||
|
||
const projetImg = document.createElement("img"); | ||
projetImg.src = projet.imageUrl; | ||
// const projetImg = document.createElement("img"); | ||
// projetImg.src = projet.imageUrl; | ||
|
||
const projetCaption = document.createElement("figcaption"); | ||
projetCaption.innerText = projet.title; | ||
// const projetCaption = document.createElement("figcaption"); | ||
// projetCaption.innerText = projet.title; | ||
|
||
projetFigure.appendChild(projetImg); | ||
projetFigure.appendChild(projetCaption); | ||
sectionProjet.appendChild(projetFigure); | ||
// projetFigure.appendChild(projetImg); | ||
// projetFigure.appendChild(projetCaption); | ||
// sectionProjet.appendChild(projetFigure); | ||
|
||
console.log(projet); | ||
}); | ||
|
||
// alert(`bonjour ${works[0].title}`); | ||
}); | ||
// console.log(projet); | ||
// }); | ||
// // | ||
// // alert(`bonjour ${works[0].title}`); | ||
// }); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters