aboutsummaryrefslogtreecommitdiff
path: root/packages/taler-wallet-webextension/src/cta/Tip/state.ts
diff options
context:
space:
mode:
Diffstat (limited to 'packages/taler-wallet-webextension/src/cta/Tip/state.ts')
-rw-r--r--packages/taler-wallet-webextension/src/cta/Tip/state.ts17
1 files changed, 4 insertions, 13 deletions
diff --git a/packages/taler-wallet-webextension/src/cta/Tip/state.ts b/packages/taler-wallet-webextension/src/cta/Tip/state.ts
index f6721d504..00e1fddad 100644
--- a/packages/taler-wallet-webextension/src/cta/Tip/state.ts
+++ b/packages/taler-wallet-webextension/src/cta/Tip/state.ts
@@ -15,20 +15,18 @@
*/
import { Amounts } from "@gnu-taler/taler-util";
-import { useState } from "preact/hooks";
+import { WalletApiOperation } from "@gnu-taler/taler-wallet-core";
import { useAsyncAsHook } from "../../hooks/useAsyncAsHook.js";
-import * as wxApi from "../../wxApi.js";
+import { wxApi } from "../../wxApi.js";
import { Props, State } from "./index.js";
export function useComponentState(
{ talerTipUri, onCancel, onSuccess }: Props,
api: typeof wxApi,
): State {
- const [tipIgnored, setTipIgnored] = useState(false);
-
const tipInfo = useAsyncAsHook(async () => {
if (!talerTipUri) throw Error("ERROR_NO-URI-FOR-TIP");
- const tip = await api.prepareTip({ talerTipUri });
+ const tip = await api.wallet.call(WalletApiOperation.PrepareTip, { talerTipUri });
return { tip };
});
@@ -48,7 +46,7 @@ export function useComponentState(
const { tip } = tipInfo.response;
const doAccept = async (): Promise<void> => {
- const res = await api.acceptTip({ walletTipId: tip.walletTipId });
+ const res = await api.wallet.call(WalletApiOperation.AcceptTip, { walletTipId: tip.walletTipId });
//FIX: this may not be seen since we are moving to the success also
tipInfo.retry();
@@ -65,13 +63,6 @@ export function useComponentState(
},
};
- if (tipIgnored) {
- return {
- status: "ignored",
- ...baseInfo,
- };
- }
-
if (tip.accepted) {
return {
status: "accepted",