summaryrefslogtreecommitdiff
path: root/packages/taler-wallet-webextension/src/cta/Tip/state.ts
diff options
context:
space:
mode:
authorSebastian <sebasjm@gmail.com>2022-10-25 12:23:08 -0300
committerSebastian <sebasjm@gmail.com>2022-10-25 19:19:09 -0300
commita286649b0a611d87916a178a795c1acd2917741c (patch)
tree86d0a8eefb791ffebc877a88d6876d1ff764cf2b /packages/taler-wallet-webextension/src/cta/Tip/state.ts
parent5fcd434f662bcef7e9e043763766c8b104ad6b97 (diff)
downloadwallet-core-a286649b0a611d87916a178a795c1acd2917741c.tar.gz
wallet-core-a286649b0a611d87916a178a795c1acd2917741c.tar.bz2
wallet-core-a286649b0a611d87916a178a795c1acd2917741c.zip
cherry-pick: using new wallet typed api missing test
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",