diff options
Diffstat (limited to 'packages/demobank-ui/src/pages/OperationState')
-rw-r--r-- | packages/demobank-ui/src/pages/OperationState/index.ts | 26 | ||||
-rw-r--r-- | packages/demobank-ui/src/pages/OperationState/state.ts | 8 | ||||
-rw-r--r-- | packages/demobank-ui/src/pages/OperationState/views.tsx | 5 |
3 files changed, 23 insertions, 16 deletions
diff --git a/packages/demobank-ui/src/pages/OperationState/index.ts b/packages/demobank-ui/src/pages/OperationState/index.ts index 20cb1760f..e4d9d45e3 100644 --- a/packages/demobank-ui/src/pages/OperationState/index.ts +++ b/packages/demobank-ui/src/pages/OperationState/index.ts @@ -39,8 +39,9 @@ import { RouteDefinition } from "../../route.js"; export interface Props { currency: string; onAuthorizationRequired: () => void; - routeClose: RouteDefinition<Record<string, never>>; + routeClose: RouteDefinition; onAbort: () => void; + routeHere: RouteDefinition<{ wopid: string }>; } export type State = @@ -81,7 +82,7 @@ export namespace State { onAbort: () => Promise< TalerCoreBankErrorsByMethod<"abortWithdrawalById"> | undefined >; - routeClose: RouteDefinition<Record<string, never>>; + routeClose: RouteDefinition; } export interface InvalidPayto { @@ -103,28 +104,29 @@ export namespace State { status: "need-confirmation"; onAuthorizationRequired: () => void; account: string; + routeHere: RouteDefinition<{ wopid: string }>; onAbort: - | undefined - | (() => Promise< - TalerCoreBankErrorsByMethod<"abortWithdrawalById"> | undefined - >); + | undefined + | (() => Promise< + TalerCoreBankErrorsByMethod<"abortWithdrawalById"> | undefined + >); onConfirm: - | undefined - | (() => Promise< - TalerCoreBankErrorsByMethod<"confirmWithdrawalById"> | undefined - >); + | undefined + | (() => Promise< + TalerCoreBankErrorsByMethod<"confirmWithdrawalById"> | undefined + >); error: undefined; id: string; } export interface Aborted { status: "aborted"; error: undefined; - routeClose: RouteDefinition<Record<string, never>>; + routeClose: RouteDefinition; } export interface Confirmed { status: "confirmed"; error: undefined; - routeClose: RouteDefinition<Record<string, never>>; + routeClose: RouteDefinition; } } diff --git a/packages/demobank-ui/src/pages/OperationState/state.ts b/packages/demobank-ui/src/pages/OperationState/state.ts index 20d66bbb1..ad2d91ee4 100644 --- a/packages/demobank-ui/src/pages/OperationState/state.ts +++ b/packages/demobank-ui/src/pages/OperationState/state.ts @@ -38,6 +38,7 @@ export function useComponentState({ currency, routeClose, onAbort, + routeHere, onAuthorizationRequired, }: Props): utils.RecursiveState<State> { const [settings] = usePreferences(); @@ -190,9 +191,9 @@ export function useComponentState({ routeClose, onAbort: !creds ? async () => { - onAbort(); - return undefined; - } + onAbort(); + return undefined; + } : doAbort, }; } @@ -220,6 +221,7 @@ export function useComponentState({ return { status: "need-confirmation", error: undefined, + routeHere, onAuthorizationRequired, account: data.username, id: withdrawalOperationId, diff --git a/packages/demobank-ui/src/pages/OperationState/views.tsx b/packages/demobank-ui/src/pages/OperationState/views.tsx index d086c3dd1..6eee6daa9 100644 --- a/packages/demobank-ui/src/pages/OperationState/views.tsx +++ b/packages/demobank-ui/src/pages/OperationState/views.tsx @@ -51,6 +51,7 @@ export function InvalidReserveView({ reserve }: State.InvalidReserve) { export function NeedConfirmationView({ onAbort: doAbort, onConfirm: doConfirm, + routeHere, account, id, onAuthorizationRequired, @@ -144,7 +145,9 @@ export function NeedConfirmationView({ operation: "confirm-withdrawal", id: String(resp.body.challenge_id), sent: AbsoluteTime.never(), + location: routeHere.url({ wopid: id }), request: id, + }); return onAuthorizationRequired(); } @@ -331,7 +334,7 @@ export function ConfirmedView({ routeClose }: State.Confirmed) { export function ReadyView({ uri, onAbort: doAbort, -}: State.Ready): VNode<Record<string, never>> { +}: State.Ready): VNode { const { i18n } = useTranslationContext(); const walletInegrationApi = useTalerWalletIntegrationAPI(); const [notification, notify, errorHandler] = useLocalNotification(); |