{
const queryString = new URLSearchParams(new FormData($refs.filter_form)).toString()
console.log(queryString);
this.loading = true;
// Show the loader
document.querySelector('#loaderContainer').style.display = 'flex';
fetch('/collections/ingredients?' + queryString)
.then(response => response.text())
.then(data => {
let html_div = document.createElement('div');
html_div.innerHTML = data;
let html_dom = html_div.querySelector('#ProductGridContainer').innerHTML;
document.querySelector('#ProductGridContainer').innerHTML = html_dom;
// update URL without refreshing the page
history.replaceState(null, null, '?' + queryString);
})
.catch(error => console.error('Error:', error))
.finally(() => {
// Hide the loader
document.querySelector('#loaderContainer').style.display = 'none';
this.loading = false;
// Update the currency based on the added markets.
updateToCurrency();
});
})">