File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -26,23 +26,32 @@ export default function CovidContactStep(props) {
2626 { key : 'true' , value : t ( 'basics.yes' ) } ,
2727 { key : 'false' , value : t ( 'basics.no' ) } ,
2828 ] ;
29-
29+
3030 const [ selection , setSelection ] = useState ( props . caseReport . covid_contact !== undefined && props . caseReport . covid_contact !== null ? String ( props . caseReport . covid_contact ) : undefined ) ;
3131
3232 const onSelect = item => {
3333 setSelection ( item ) ;
3434 if ( AUTO_NEXT_ENABLED ) {
3535 // onNext is triggers faster then the state change?
36- props . onNext ( getStateToBeSaved ( item === 'true' ) ) ;
36+ props . onNext ( getStateToBeSaved ( item ) ) ;
3737 }
3838 } ;
3939
4040 const getStateToBeSaved = ( status = null ) => {
4141 const caseReport = { ...props . caseReport } ;
4242
4343 if ( status == null ) {
44- status = selection == 'true' ;
44+ status = selection ;
45+ }
46+
47+ if ( status === 'true' ) {
48+ caseReport . covid_contact = true ;
4549 }
50+
51+ if ( status === 'false' ) {
52+ caseReport . covid_contact = false ;
53+ }
54+
4655 caseReport . covid_contact = status ;
4756 return caseReport ;
4857 } ;
You can’t perform that action at this time.
0 commit comments