Skip to content

Commit 971fdf3

Browse files
authored
fix: redirects to correct results page (#180)
Signed-off-by: Anthony D. Mays <[email protected]>
1 parent f3de433 commit 971fdf3

File tree

1 file changed

+2
-2
lines changed
  • lib/javascript/quiz-app/src/app/vote/[promptId]

1 file changed

+2
-2
lines changed

lib/javascript/quiz-app/src/app/vote/[promptId]/page.tsx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -19,13 +19,13 @@ export default async function VotePage({
1919

2020
// Check if user has already voted
2121
const hasVoted = await getUserVote(userId)
22+
const promptId = +(await params).promptId;
2223

2324
// Redirect to results if already voted
2425
if (hasVoted) {
25-
return redirect("/results")
26+
return redirect(`/results/${promptId}`)
2627
}
2728

28-
const promptId = +(await params).promptId;
2929
const prompt = await getPrompt(promptId);
3030
const topic = '' + prompt?.Prompt;
3131
const options = (prompt?.Options as {options: string[]}).options;

0 commit comments

Comments
 (0)