|
@@ -102,25 +102,26 @@ class TextFields extends React.Component {
|
|
|
}
|
|
|
|
|
|
submitForm = async () => {
|
|
|
- console.log(this.state)
|
|
|
- const body = JSON.stringify({
|
|
|
- name: this.state.name,
|
|
|
- cat: this.state.cat,
|
|
|
- guest: this.state.significantOther,
|
|
|
- })
|
|
|
+ if (this.state.name && this.state.name.length > 0) {
|
|
|
+ const body = JSON.stringify({
|
|
|
+ name: this.state.name,
|
|
|
+ cat: this.state.cat,
|
|
|
+ guest: this.state.significantOther,
|
|
|
+ })
|
|
|
|
|
|
- const response = await fetch('/attendee', {
|
|
|
- method: 'post',
|
|
|
- body: body,
|
|
|
- headers: new Headers({
|
|
|
- 'Content-Type': 'application/json'
|
|
|
+ const response = await fetch('/attendee', {
|
|
|
+ method: 'post',
|
|
|
+ body: body,
|
|
|
+ headers: new Headers({
|
|
|
+ 'Content-Type': 'application/json'
|
|
|
+ })
|
|
|
})
|
|
|
- })
|
|
|
|
|
|
- if (!response.error) {
|
|
|
- console.log('Success')
|
|
|
- this.setState({attendees: MakeAttendees(await this.fetchAttendees())})
|
|
|
- addHugeAssImage()
|
|
|
+ if (!response.error) {
|
|
|
+ console.log('Success')
|
|
|
+ this.setState({attendees: MakeAttendees(await this.fetchAttendees())})
|
|
|
+ addHugeAssImage()
|
|
|
+ }
|
|
|
}
|
|
|
}
|
|
|
|