summaryrefslogtreecommitdiff
path: root/packages/demobank-ui/src/pages/SolveChallengePage.tsx
diff options
context:
space:
mode:
Diffstat (limited to 'packages/demobank-ui/src/pages/SolveChallengePage.tsx')
-rw-r--r--packages/demobank-ui/src/pages/SolveChallengePage.tsx11
1 files changed, 7 insertions, 4 deletions
diff --git a/packages/demobank-ui/src/pages/SolveChallengePage.tsx b/packages/demobank-ui/src/pages/SolveChallengePage.tsx
index 5ac622795..b7fc82a94 100644
--- a/packages/demobank-ui/src/pages/SolveChallengePage.tsx
+++ b/packages/demobank-ui/src/pages/SolveChallengePage.tsx
@@ -46,13 +46,14 @@ import { RouteDefinition } from "../route.js";
import { undefinedIfEmpty } from "../utils.js";
import { RenderAmount } from "./PaytoWireTransferForm.js";
import { OperationNotFound } from "./WithdrawalQRCode.js";
+import { useNavigationContext } from "../context/navigation.js";
export function SolveChallengePage({
onChallengeCompleted,
routeClose,
}: {
onChallengeCompleted: () => void;
- routeClose: RouteDefinition<Record<string, never>>;
+ routeClose: RouteDefinition;
}): VNode {
const { api } = useBankCoreApiContext();
const { i18n } = useTranslationContext();
@@ -61,6 +62,7 @@ export function SolveChallengePage({
const [notification, notify, handleError] = useLocalNotification();
const { state } = useBackendState();
const creds = state.status !== "loggedIn" ? undefined : state;
+ const { navigateTo } = useNavigationContext();
if (!bankState.currentChallenge) {
return (
@@ -209,6 +211,7 @@ export function SolveChallengePage({
updateBankState("currentChallenge", {
operation: ch.operation,
id: String(resp.body.challenge_id),
+ location: ch.location,
sent: AbsoluteTime.never(),
request: ch.request,
});
@@ -262,7 +265,7 @@ export function SolveChallengePage({
onStart={startChallenge}
onCancel={() => {
updateBankState("currentChallenge", undefined);
- onChallengeCompleted();
+ navigateTo(ch.location)
}}
/>
{ch.info && (
@@ -304,7 +307,7 @@ export function SolveChallengePage({
</div>
</div>
<div class="flex items-center justify-between border-gray-900/10 px-4 py-4 ">
- <div />
+ <div />
<button
type="submit"
name="confirm"
@@ -344,7 +347,7 @@ function ChallengeDetails({
if (firstTime) {
onStart()
}
- },[])
+ }, [])
return (
<div class="px-4 mt-4 ">
<div class="w-full">