Skip to content

Commit

Permalink
Moved array to a variable
Browse files Browse the repository at this point in the history
  • Loading branch information
dhochbaum-dcp committed Apr 23, 2024
1 parent 94cc054 commit 8aadc56
Showing 1 changed file with 11 additions and 17 deletions.
28 changes: 11 additions & 17 deletions app/controllers/bookmarks.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,15 @@ import { inject as service } from '@ember/service';
import { computed as computedProp } from '@ember/object';
import { Promise } from 'rsvp';

const QUERY_PARAMS_LIST = [
'selectedZoning',
'selectedOverlays',
'selectedFirm',
'selectedPfirm',
'selectedCouncilDistricts',
'selectedLayerGroup',
];

export default Controller.extend({
mainMap: service(),
metrics: service(),
Expand Down Expand Up @@ -60,15 +69,7 @@ export default Controller.extend({
});

const queryParams = {};
[
'layer-groups',
'selectedZoning',
'selectedOverlays',
'selectedFirm',
'selectedPfirm',
'selectedCouncilDistricts',
'selectedLayerGroup',
].forEach((selected) => {
['layer-groups', ...QUERY_PARAMS_LIST].forEach((selected) => {
queryParams[selected] = this.router.currentRoute.queryParams[selected]
? JSON.parse(this.router.currentRoute.queryParams[selected])
: undefined;
Expand Down Expand Up @@ -142,14 +143,7 @@ export default Controller.extend({
});
});

[
'selectedZoning',
'selectedOverlays',
'selectedFirm',
'selectedPfirm',
'selectedCouncilDistricts',
'selectedLayerGroup',
].forEach((selected) => {
QUERY_PARAMS_LIST.forEach((selected) => {
this.router.currentRoute.queryParams[selected] =
layerToLoad.queryParams[selected];
});
Expand Down

0 comments on commit 8aadc56

Please sign in to comment.