Skip to content

Commit

Permalink
Explicitly create new transactions on ctx.redirect
Browse files Browse the repository at this point in the history
This allows redirecting to the same action to restart it.
  • Loading branch information
jacobmischka committed Jun 5, 2023
1 parent 04db092 commit 57511cc
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion src/examples/basic/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2092,9 +2092,14 @@ const interval = new Interval({
{ label: 'Make it negative', theme: 'danger', value: 'negative' },
{ label: 'Do nothing', value: 'nothing' },
'Think about it for a while',
'?',
'Restart',
])

if (singleChoice === 'Restart') {
await ctx.redirect({ route: 'with_choices' })
return
}

if (singleReturnValue && singleChoice === 'negative') {
singleReturnValue = -singleReturnValue
}
Expand Down

0 comments on commit 57511cc

Please sign in to comment.