From 79f9c89ad857a81e349ad5d0974803ee50b98b16 Mon Sep 17 00:00:00 2001 From: ks129 <45097959+ks129@users.noreply.github.com> Date: Tue, 19 Jan 2021 20:04:36 +0200 Subject: Merge switch's cases --- src/components/Question.tsx | 24 ++---------------------- 1 file changed, 2 insertions(+), 22 deletions(-) diff --git a/src/components/Question.tsx b/src/components/Question.tsx index df9d18e..750dd64 100644 --- a/src/components/Question.tsx +++ b/src/components/Question.tsx @@ -52,12 +52,7 @@ class RenderedQuestion extends React.Component { if (this.props.question.required) { let invalid = false; switch (this.props.question.type) { - case QuestionType.ShortText: - if (event.target.value === "") { - invalid = true; - } - break; - + case QuestionType.ShortText: case QuestionType.TextArea: if (event.target.value === "") { invalid = true; @@ -155,12 +150,7 @@ class RenderedQuestion extends React.Component { let invalid = false; const options: string | string[] = this.props.question.data["options"]; switch (this.props.question.type) { - case QuestionType.TextArea: - if (this.props.public_state.get("value") === "") { - invalid = true; - } - break; - + case QuestionType.TextArea: case QuestionType.ShortText: if (this.props.public_state.get("value") === "") { invalid = true; @@ -168,17 +158,7 @@ class RenderedQuestion extends React.Component { break; case QuestionType.Select: - if (!this.props.public_state.get("value")) { - invalid = true; - } - break; - case QuestionType.Range: - if (!this.props.public_state.get("value")) { - invalid = true; - } - break; - case QuestionType.Radio: if (!this.props.public_state.get("value")) { invalid = true; -- cgit v1.2.3