mirror of
https://github.com/tomru/pfadi-bussle.git
synced 2026-03-03 06:27:11 +01:00
change wizard a bit
This commit is contained in:
@@ -22,7 +22,26 @@ function WizardInternal() {
|
||||
const isLastStep = currentStep === STEPS.length - 1
|
||||
|
||||
return (
|
||||
<Form>
|
||||
<Form
|
||||
onSubmit={(event) => {
|
||||
event.preventDefault()
|
||||
|
||||
const fd = new FormData(event.currentTarget)
|
||||
for (const [key, value] of fd.entries()) {
|
||||
console.log(key, value)
|
||||
}
|
||||
|
||||
console.log(state)
|
||||
|
||||
return
|
||||
|
||||
if (!isLastStep) {
|
||||
dispatch({ type: ACTIONS.NEXT_STEP })
|
||||
return
|
||||
}
|
||||
dispatch({ type: ACTIONS.SUBMIT })
|
||||
}}
|
||||
>
|
||||
{STEPS.map(({ id, component: Component }, index) => (
|
||||
<>{currentStep === index && <Component />}</>
|
||||
))}
|
||||
@@ -34,14 +53,8 @@ function WizardInternal() {
|
||||
Zurück
|
||||
</Button>
|
||||
)}
|
||||
{!isLastStep && (
|
||||
<Button onClick={() => dispatch({ type: ACTIONS.NEXT_STEP })}>
|
||||
Weiter
|
||||
</Button>
|
||||
)}
|
||||
{isLastStep && (
|
||||
<Button onClick={() => console.log('SEND OFF', state)}>Absenden</Button>
|
||||
)}
|
||||
{!isLastStep && <Button type="submit">Weiter</Button>}
|
||||
{isLastStep && <Button>Absenden</Button>}
|
||||
</Form>
|
||||
)
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user