helper function
This commit is contained in:
parent
ab37400522
commit
7253c40da1
|
@ -0,0 +1,16 @@
|
||||||
|
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;
|
||||||
|
}
|
Loading…
Reference in New Issue