From 59d235e8d29159bc8caccf8bee6a2bca8b0b90dc Mon Sep 17 00:00:00 2001 From: Sebastian Date: Fri, 16 Sep 2022 16:03:58 -0300 Subject: redirect after success #7357 --- packages/taler-wallet-webextension/src/cta/Refund/state.ts | 14 ++++---------- 1 file changed, 4 insertions(+), 10 deletions(-) (limited to 'packages/taler-wallet-webextension/src/cta/Refund/state.ts') diff --git a/packages/taler-wallet-webextension/src/cta/Refund/state.ts b/packages/taler-wallet-webextension/src/cta/Refund/state.ts index 8d36b61ea..16dbbf70d 100644 --- a/packages/taler-wallet-webextension/src/cta/Refund/state.ts +++ b/packages/taler-wallet-webextension/src/cta/Refund/state.ts @@ -21,7 +21,7 @@ import * as wxApi from "../../wxApi.js"; import { Props, State } from "./index.js"; export function useComponentState( - { talerRefundUri, cancel }: Props, + { talerRefundUri, cancel, onSuccess }: Props, api: typeof wxApi, ): State { const [ignored, setIgnored] = useState(false); @@ -51,8 +51,9 @@ export function useComponentState( const { refund, uri } = info.response; const doAccept = async (): Promise => { - await api.applyRefund(uri); - info.retry(); + const res = await api.applyRefund(uri); + + onSuccess(res.transactionId); }; const doIgnore = async (): Promise => { @@ -75,13 +76,6 @@ export function useComponentState( }; } - if (Amounts.isZero(baseInfo.awaitingAmount)) { - return { - status: "completed", - ...baseInfo, - }; - } - if (refund.pending) { return { status: "in-progress", -- cgit v1.2.3