modifying brochureHydratation to handle user current language

This commit is contained in:
Antoine M 2023-11-28 17:33:54 +01:00
parent d67b9c8291
commit cc87bcc259

View File

@ -76,7 +76,10 @@ function toggleActiveFilterButton(e) {
} }
async function hydrateBrochureArchiveGrid() { async function hydrateBrochureArchiveGrid() {
const response = await fetch(`/wp-json/homegrade-datas/v1/build/brochures-archive-rows`); const currentLanguage = document.querySelector('body').getAttribute('current-language');
const response = await fetch(
`/wp-json/homegrade-datas/v1/build/brochures-archive-rows?current-page-language=${currentLanguage}`
);
brochuresDatas = await response.json(); brochuresDatas = await response.json();
const brochureRows = document.querySelector('.brochures-archives #brochures-rows'); const brochureRows = document.querySelector('.brochures-archives #brochures-rows');