Skip to content

Commit

Permalink
feat: reset form location if forest type is missing in options
Browse files Browse the repository at this point in the history
  • Loading branch information
friedjoff committed Oct 10, 2020
1 parent 19a6932 commit 34cec44
Showing 1 changed file with 10 additions and 0 deletions.
10 changes: 10 additions & 0 deletions src/store/enhancers/projection.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ import {
SET_FORM_LOCATION,
SET_MAP_LOCATION,
SET_PROJECTION_MODE,
setFormLocation,
setLocation,
setLocationResult,
setProjectionResult,
Expand Down Expand Up @@ -70,6 +71,15 @@ const projection = (store) => (next) => (action) => {
} = mapLocation;
projectionResult.moderate = runProject(location, targetAZModerate);
projectionResult.extreme = runProject(location, targetAZExtreme);

const { options } = projectionResult.extreme;
if (
location.forestType &&
options.forestType &&
options.forestType.includes(location.forestType) === false
) {
store.dispatch(setFormLocation({ forestType: null }));
}
} else {
const { targetAltitudinalZone: targetAZForm } = formLocation;
projectionResult.form = runProject(location, targetAZForm);
Expand Down

0 comments on commit 34cec44

Please sign in to comment.