diff --git a/resources/js/taxonomy-thematique-(faq).js b/resources/js/taxonomy-thematique-(faq).js index 767da32..f8900cd 100644 --- a/resources/js/taxonomy-thematique-(faq).js +++ b/resources/js/taxonomy-thematique-(faq).js @@ -1,20 +1,20 @@ -async function fetchMoreThematiquePostDatas() { - // const response = await fetch('/wp-json/wp/v2/questions?per_page=100'); - const response = await fetch('/wp-json/wp/v2/questions?thematiques=41'); +async function fetchMoreThematiquePostDatas(id) { + const response = await fetch(`/wp-json/homegrade-datas/v1/questions-thematiques/${id}`); const data = await response.json(); - console.log(data); return data; } async function handleLoadMoreClick() { - const posts = await fetchMoreThematiquePostDatas(); + const currentTermId = mainAppJsDynamicDatas.current_thematique.term_id; + const posts = await fetchMoreThematiquePostDatas(currentTermId); + console.log(posts); const postsContainer = document.querySelector('.post-question-page__accordeons-container'); - console.log(mainAppJsDynamicDatas.current_thematique); - posts.forEach((post) => { - let newContent = createDetailsElement(post); - postsContainer.appendChild(newContent); - }); + // console.log(posts); + // posts.forEach((post) => { + // let newContent = createDetailsElement(post); + // postsContainer.appendChild(newContent); + // }); } function createDetailsElement(post) { @@ -44,7 +44,7 @@ function createDetailsElement(post) { } export default async function taxonomyThematiqueFaqInit() { - console.log(mainAppJsDynamicDatas); + // console.log(mainAppJsDynamicDatas); const currentQuestionPage = document.querySelector('.post-question-page'); const filters = document.querySelectorAll('.thematiques-subtaxonomy-links li'); if (!currentQuestionPage) return;