Fix <EnquiryFormControlled /> Alert

This commit is contained in:
Eric Jinks 2018-01-23 14:35:51 +10:00
parent 077784b97d
commit b55a6e4f7c
2 changed files with 8 additions and 3 deletions

View file

@ -39,5 +39,6 @@
.EnquiryForm--Alert {
background: whitesmoke;
width: 100%;
text-align: center;
padding: 2rem;
}

View file

@ -47,8 +47,8 @@ class Form extends Component {
})
}
resetForm = () => {
this.setState({ ...this.initialState })
resetForm = customState => {
this.setState({ ...this.initialState, ...customState })
this.inputs.forEach(input => {
delete input.dataset.touched
})
@ -75,7 +75,11 @@ class Form extends Component {
throw new Error('Network error')
}
})
.then(this.resetForm)
.then(
this.resetForm({
alert: 'Thanks for your enquiry, we will get back to you soon.'
})
)
.catch(err => {
console.log(err)
this.setState({