Update birthdate in store
This commit is contained in:
parent
544f26f019
commit
d6022cd880
@ -1,5 +1,7 @@
|
|||||||
import React from 'react';
|
import React from 'react';
|
||||||
|
import { useDispatch } from 'react-redux';
|
||||||
|
|
||||||
|
import { actions } from '@/store';
|
||||||
import InputWrapper from '../input-wrapper/input-wrapper';
|
import InputWrapper from '../input-wrapper/input-wrapper';
|
||||||
import InputItem from '../input-item/input-item';
|
import InputItem from '../input-item/input-item';
|
||||||
import Button from '../button/button';
|
import Button from '../button/button';
|
||||||
@ -15,6 +17,7 @@ const dateDivider = '-';
|
|||||||
|
|
||||||
export default function StepBirthdate() {
|
export default function StepBirthdate() {
|
||||||
const steps = useSteps();
|
const steps = useSteps();
|
||||||
|
const dispatch = useDispatch();
|
||||||
|
|
||||||
const [year, setYear] = React.useState('');
|
const [year, setYear] = React.useState('');
|
||||||
const [month, setMonth] = React.useState('');
|
const [month, setMonth] = React.useState('');
|
||||||
@ -128,7 +131,11 @@ export default function StepBirthdate() {
|
|||||||
const onNext = () => {
|
const onNext = () => {
|
||||||
if (!formIsValid) return;
|
if (!formIsValid) return;
|
||||||
|
|
||||||
steps.saveCurrent([year, month, day].join(dateDivider));
|
const birthdate = [year, month, day].join(dateDivider);
|
||||||
|
|
||||||
|
dispatch(actions.form.addDate(birthdate));
|
||||||
|
|
||||||
|
steps.saveCurrent(birthdate);
|
||||||
|
|
||||||
steps.goNext();
|
steps.goNext();
|
||||||
};
|
};
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user