improve client a bit

This commit is contained in:
Thomas Ruoff
2020-08-01 14:31:34 +02:00
parent 027cf45faa
commit 9570c6996c
6 changed files with 126 additions and 28 deletions

View File

@@ -1,4 +1,4 @@
import { useContext, useRef } from 'react'
import { useContext } from 'react'
import Button from 'react-bootstrap/Button'
import Form from 'react-bootstrap/Form'
@@ -11,7 +11,23 @@ import Contact from './contact'
//import Driver from './driver'
function WizardInternal() {
const { state, storeBooking } = useContext(WizardContext)
const { onSubmit, state } = useContext(WizardContext)
const { postData, postDataSuccess, postDataError } = state
if (postDataSuccess) {
return (
<>
<h3>Danke, die Buchung ist in Bearbeitung!</h3>
<p>Wir melden uns per E-Mail sobald die Buchung bestätigt ist.</p>
<p>
Sollen die eingegebenen Daten in Deinem Browser für die nächste
Buchung gespeichert werden?
</p>
<Button>Ja, bitte speichern</Button>
</>
)
}
const onChange = (payload) =>
dispatch({ action: ACTIONS.SET_FORM_DATA, payload })
@@ -19,14 +35,16 @@ function WizardInternal() {
<Form
onSubmit={(event) => {
event.preventDefault()
storeBooking()
onSubmit()
}}
>
<DateSelect />
<Reason />
<Contact />
<Button type="submit">Absenden</Button>
<div>{postDataError}</div>
<Button type="submit" disabled={postData}>
{postData ? 'Speichern...' : 'Absenden'}
</Button>
</Form>
)
}