fix: can submit

pull/89/head
Pierre-Louis Guhur 1 year ago
parent 9ff0de63e8
commit ad11fe595c

@ -50,6 +50,7 @@ const TitleField = () => {
const CandidatesField = () => { const CandidatesField = () => {
const {t} = useTranslation(); const {t} = useTranslation();
const election = useElection(); const election = useElection();
return ( return (
<Container className="bg-white p-4 mt-3 mt-md-0"> <Container className="bg-white p-4 mt-3 mt-md-0">
<Row> <Row>
@ -101,7 +102,7 @@ const submitElection = (election: ElectionContextInterface, callback) => {
urlResult, urlResult,
); );
} }
callback(); callback(payload);
} }
) )
} }

@ -51,15 +51,17 @@ const Grades = () => {
const [endDate, setEndDate] = useState(defaultEndDate); const [endDate, setEndDate] = useState(defaultEndDate);
useEffect(() => { useEffect(() => {
dispatch({ if (election.grades.length < 2) {
type: 'set', dispatch({
field: 'grades', type: 'set',
value: DEFAULT_GRADES.map((g, i) => ({ field: 'grades',
name: t(g), value: DEFAULT_GRADES.map((g, i) => ({
value: i, name: t(g),
active: true, value: i,
})), active: true,
}); })),
});
}
}, []); }, []);
const election = useElection(); const election = useElection();

@ -34,11 +34,6 @@ const CreateElectionForm = () => {
} }
}; };
if (wait) {
return <PatternedBackground>
<WaitingBallot election={payload} />
</PatternedBackground>
}
// at which creation step are we? // at which creation step are we?
const [stepId, setStepId] = useState(0); const [stepId, setStepId] = useState(0);
@ -62,6 +57,12 @@ const CreateElectionForm = () => {
throw Error(`Unknown step ${step}`); throw Error(`Unknown step ${step}`);
} }
if (wait) {
return <PatternedBackground>
<WaitingBallot election={payload} />
</PatternedBackground>
}
return ( return (
<ElectionProvider> <ElectionProvider>
<ProgressSteps <ProgressSteps

Loading…
Cancel
Save