From a1ab03365770fd976e71969820378547a1345a03 Mon Sep 17 00:00:00 2001 From: Brion Mario Date: Thu, 18 Apr 2019 22:52:41 +0530 Subject: [PATCH] fix(forms): fix validation issues and remove workaround :bug: --- .../sessions/create-questionnaire/submit.js | 24 ++++--------------- 1 file changed, 5 insertions(+), 19 deletions(-) diff --git a/src/forms/sessions/create-questionnaire/submit.js b/src/forms/sessions/create-questionnaire/submit.js index 2f87316..9dd48e0 100644 --- a/src/forms/sessions/create-questionnaire/submit.js +++ b/src/forms/sessions/create-questionnaire/submit.js @@ -1,31 +1,17 @@ import _ from 'lodash'; -import validate from './validate'; -import store from '../../../redux/store'; -import {addNotification} from '../../../redux/actions/notification-actions'; import {createQuestionnaire} from '../../../redux/actions/session-actions'; function submit(values, dispatch, props) { - // dirty trick to get around the redux form validation issue. - // TODO: Update redux form library - let formErrors = validate(values); let body = { pre: {}, post: {} }; - if (_.isEmpty(formErrors)) { - if (props.config.type === 'pre') { - _.assign(body.pre, values) - dispatch(createQuestionnaire(body)); - } else if (props.config.type === 'post') { - _.assign(body.post, values) - } - } else { - let notification = { - level: 3, - message: 'Some form values appear to be empty.', - }; - store.dispatch(addNotification(notification)); + if (props.config.type === 'pre') { + _.assign(body.pre, values); + dispatch(createQuestionnaire(body)); + } else if (props.config.type === 'post') { + _.assign(body.post, values) } }