Skip to content

Commit

Permalink
both poll-vote and poll-result use id now
Browse files Browse the repository at this point in the history
  • Loading branch information
SachdevJai committed Jun 25, 2023
1 parent 63692f6 commit 08e988e
Show file tree
Hide file tree
Showing 3 changed files with 3 additions and 3 deletions.
2 changes: 1 addition & 1 deletion routes/polls.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ const dbh = require('../database/handler');
// Route for opening poll or poll list
router.get('/', async (req, res) => {
if (!req.loggedIn) return res.loginRedirect(req, res);
const pollId = req.query.pollId;
const pollId = req.query.id;
const activePolls = await dbh.getActivePolls();
if (!pollId) return res.renderFile('poll_list.njk', {
activePolls,
Expand Down
2 changes: 1 addition & 1 deletion templates/poll_list.njk
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@
<div class="poll">
<div class="title"> {{ poll.title }} </div>
<div class="buttons">
<button onclick="window.location.href = '/polls?pollId={{ poll._id }}'">Vote</button>
<button onclick="window.location.href = '/polls?id={{ poll._id }}'">Vote</button>
<button onclick="window.location.href = '/polls/results?id={{ poll._id }}'">Result</button>
</div>
</div>
Expand Down
2 changes: 1 addition & 1 deletion templates/poll_vote.njk
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@
setTimeout(function () {e.classList.add('hidden')}, 2000);
if (response.success) {
setTimeout(function () {
window.location.href = "/polls/results/{{ poll._id }}";
window.location.href = "/polls/results?id={{ poll._id }}";
}, 3000);
}
}
Expand Down

0 comments on commit 08e988e

Please sign in to comment.