Skip to content

Commit

Permalink
Update queryParams.mjs
Browse files Browse the repository at this point in the history
  • Loading branch information
simon-leech committed Oct 13, 2023
1 parent de71034 commit 7ffe4d1
Showing 1 changed file with 9 additions and 6 deletions.
15 changes: 9 additions & 6 deletions lib/utils/queryParams.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down

0 comments on commit 7ffe4d1

Please sign in to comment.