add appStore and use router for booking

This commit is contained in:
Thomas Ruoff
2020-08-19 00:59:45 +02:00
parent 194ac0aca1
commit e1d1de469b
8 changed files with 80 additions and 26 deletions

View File

@@ -1,14 +1,14 @@
import React, { useContext } from 'react'
import WizardStore, { WizardContext } from '../context/wizardStore'
import { AppContext } from '../context/appStore'
import DateSelect from './dateSelect'
import Reason from './reason'
import Contact from './contact'
//import Driver from './driver'
function WizardInternal() {
const { onSubmit, state, storeData, forgetData } = useContext(WizardContext)
export default function Wizard() {
const { onSubmit, state, storeData, forgetData } = useContext(AppContext)
const {
postData,
postDataSuccess,
@@ -22,7 +22,7 @@ function WizardInternal() {
<>
<h3>Danke, die Buchung ist in Bearbeitung!</h3>
<p>Nach Prüfung bestätigen wir die Buchung bald per E-Mail!</p>
{typeof dataStored !== 'boolean' && (
{!dataStoredLoaded && typeof dataStored !== 'boolean' && (
<>
<p>
Sollen die eingegebenen Daten in <strong>Deinem Browser</strong>{' '}
@@ -55,9 +55,11 @@ function WizardInternal() {
}}
>
{dataStoredLoaded && (
<p>
<p className="my-12">
Gespeicherte Daten wurden aus Deinem Browser geladen.{' '}
<a onClick={forgetData}>Daten vergessen</a>
<a className="link" onClick={forgetData} href="">
Daten wieder vergessen
</a>
</p>
)}
<DateSelect />
@@ -72,11 +74,3 @@ function WizardInternal() {
</form>
)
}
export default function Wizard() {
return (
<WizardStore>
<WizardInternal />
</WizardStore>
)
}