fix: loading ballot

pull/100/head
Pierre-Louis Guhur 1 year ago
parent f22549cf80
commit c72315ebec

@ -36,11 +36,11 @@ export async function getServerSideProps({query: {pid, tid}, locale}) {
const [election, ballot, translations] = await Promise.all([
getElection(electionRef),
tid ? getBallot(tid) : new Response(null),
tid ? getBallot(tid) : null,
serverSideTranslations(locale, ['resource']),
]);
if ('msg' in election) {
if ('message' in election) {
return {notFound: true};
}
@ -66,13 +66,14 @@ export async function getServerSideProps({query: {pid, tid}, locale}) {
if (description.randomOrder) {
shuffle(election.candidates);
}
console.log("BALLOT", ballot)
return {
props: {
...translations,
election,
token: tid || null,
previousBallot: ballot,
previousBallot: ballot || null,
},
};
}

@ -271,7 +271,7 @@ export const getBallot = async (
});
if (response.status != 200) {
return null;
return {status: response.status, message: "Can not load this ballot"};
}
const payload = await response.json();

Loading…
Cancel
Save