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

17 lines
408 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) => {
const filterId = filter.id;
const filterValue = filter.value;
queryObject[filterId] = filterValue;
});
let queryString = `query=${JSON.stringify(queryObject)}`;
return queryString;
}