diff --git a/lib/utils/queryParams.mjs b/lib/utils/queryParams.mjs index deaa28197..e3debc5b1 100644 --- a/lib/utils/queryParams.mjs +++ b/lib/utils/queryParams.mjs @@ -19,16 +19,19 @@ export default _this => { // Assign fieldValues from the location to queryparams. if (Array.isArray(_this.queryparams.fieldValues) && _this.location) { + assignFieldValues(_this.queryparams.fieldValues, _this.location.infoj, _this.queryparams); + } + // Function to assign field values from infoj to queryparams. + function assignFieldValues(fieldValues, infoj, queryparams) { // Iterate through the fieldValues array. - _this.queryparams.fieldValues.forEach(field => { - + fieldValues.forEach(field => { // Find entry in location infoj matching the field. - let entry = _this.location.infoj.find(entry => entry.field === field) - + const entry = infoj.find(entry => entry.field === field); // Assign entry value as field value in queryparams. - _this.queryparams[field] = entry.value - }) + queryparams[field] = entry.value; + + }); } // Get bounds from mapview.