[VIEW] fix minor details

pull/73/head
Pierre-Louis Guhur 4 years ago
parent cd3425aa66
commit af79b633dd

@ -256,6 +256,8 @@ class CreateElection extends Component {
this.context.routesServer.setElection,
);
const {t} = this.props;
this.setState({waiting: true});
fetch(endpoint, {
@ -274,13 +276,22 @@ class CreateElection extends Component {
}),
})
.then(response => response.json())
.then(result =>
this.setState(state => ({
redirectTo: '/create-success/' + result.id,
successCreate: true,
waiting: false
})),
)
.then(result => {
console.log(result);
if (result.id) {
this.setState(state => ({
redirectTo: '/create-success/' + result.id,
successCreate: true,
waiting: false
}))
}
else {
toast.error(t('Unknown error. Try again please.'), {
position: toast.POSITION.TOP_CENTER,
});
this.setState({waiting: false});
}
})
.catch(error => error);
}

@ -200,7 +200,7 @@ class Result extends Component {
<li key={i} className="mt-2">
<span className="mt-2 ml-2">{candidate.name}</span>
<span
className="badge badge-light mr-2 mt-2"
className="badge badge-light ml-2 mt-2"
style={{
backgroundColor: electionGrades[candidate.grade].color,
color: "#fff"
@ -208,7 +208,7 @@ class Result extends Component {
>
{grades[candidate.grade].label}
</span>
<span className="badge badge-dark mr-2 mt-2 ml-2">
<span className="badge badge-dark mt-2 ml-2">
{(100 * candidate.score).toFixed(1)}%
</span>
</li>

Loading…
Cancel
Save