diff --git a/src/components/modal/report/modal.jsx b/src/components/modal/report/modal.jsx index 42aeaef8d..a41bcbe46 100644 --- a/src/components/modal/report/modal.jsx +++ b/src/components/modal/report/modal.jsx @@ -25,7 +25,8 @@ const STEPS = { category: 0, subcategory: 1, textInput: 2, - confirmation: 3 + confirmation: 3, + deadend: 4 }; class ReportModal extends React.Component { @@ -51,9 +52,13 @@ class ReportModal extends React.Component { }); } handleSetSubcategory (formData) { + const category = this.props.reportOptions.find(o => o.value === this.state.categoryValue) || this.props.reportOptions[0]; + + const subcategory = category.subcategories.find(o => o.value === formData.subcategory) || category.subcategories[0]; + return this.setState({ - subcategoryValue: formData.subcategory, - step: STEPS.textInput + subcategoryValue: subcategory.value, + step: subcategory.preventSubmission ? STEPS.deadend : STEPS.textInput }); } handleSubmit (formData) { @@ -177,9 +182,9 @@ class ReportModal extends React.Component { >
- +
- +