baseddata.io/static/js/lib/helper-functions.js

17 lines
430 B
JavaScript
Raw Normal View History

2024-09-23 17:46:20 +01:00
function queryConstructor(customFilters = {}) {
let filters = document.querySelectorAll(".filter");
let queryObject = {};
Object.assign(queryObject, customFilters);
filters.forEach((filter) => {
2024-09-23 20:11:25 +01:00
const filterId = filter.getAttribute("idFilter");
2024-09-23 17:46:20 +01:00
const filterValue = filter.value;
queryObject[filterId] = filterValue;
});
let queryString = `query=${JSON.stringify(queryObject)}`;
return queryString;
}