Fix votes from breaking server side rendering

This commit is contained in:
Wolvan 2022-01-08 16:12:51 +01:00
parent 0545d90c3f
commit 7887fa360b
2 changed files with 2 additions and 2 deletions

View file

@ -35,7 +35,7 @@ function domLoaded() {
}; };
try { try {
drawChart(JSON.parse(POLL_VOTE_DATA_STRING)); drawChart(JSON.parse(window.atob(POLL_VOTE_DATA_STRING)));
} catch (error) { } catch (error) {
// eh // eh
} }

View file

@ -123,7 +123,7 @@ export default function init(router: Router): void {
"POLL_OPTION_DIVS": pollOptionsDivs, "POLL_OPTION_DIVS": pollOptionsDivs,
"POLL_VOTES_TOTAL": totalVotes, "POLL_VOTES_TOTAL": totalVotes,
"BACKEND_BASE_PATH": (program.opts().backendBaseUrl || ""), "BACKEND_BASE_PATH": (program.opts().backendBaseUrl || ""),
"POLL_OPTION_VOTES": JSON.stringify(Object.entries(poll.votes)) "POLL_OPTION_VOTES": Buffer.from(JSON.stringify(Object.entries(poll.votes))).toString("base64")
}); });
} catch (error) { } catch (error) {
console.log(error); console.log(error);