fix(client): give useful error in solutionform (#40225)

This commit is contained in:
Shaun Hamilton
2021-02-01 13:34:04 +00:00
committed by GitHub
parent 5539dbf086
commit ab83d698f9
11 changed files with 114 additions and 40 deletions

View File

@@ -27,10 +27,20 @@ export class SolutionForm extends Component {
componentDidMount() {
this.props.updateSolutionForm({});
}
handleSubmit(values) {
this.props.updateSolutionForm(values);
this.props.onSubmit();
handleSubmit(validatedValues) {
// Do not execute challenge, if errors
if (validatedValues.errors.length === 0) {
if (validatedValues.invalidValues.length === 0) {
// updates values on server
this.props.updateSolutionForm(validatedValues.values);
this.props.onSubmit({ isShouldCompletionModalOpen: true });
} else {
this.props.onSubmit({ isShouldCompletionModalOpen: false });
}
}
}
render() {
const { isSubmitting, challengeType, description, t } = this.props;