Added validation when adding polls

This commit is contained in:
Richard Ramos 2018-06-27 15:00:50 -04:00
parent 28521fb1a5
commit 8abcd28835
1 changed files with 3 additions and 1 deletions

View File

@ -92,8 +92,10 @@ const InnerForm = ({
const StyledForm = withStyles(styles)(InnerForm);
const AddPoll = withFormik({
mapPropsToValues: props => ({ description: ''}),
validate(values){
validate(values, props){
const errors = {};
const { description } = values;
if(description.toString().trim() === "") errors.description = true;
return errors;
},
async handleSubmit(values, { setSubmitting }) {