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

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

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

Loading…
Cancel
Save