aboutsummaryrefslogtreecommitdiff
path: root/packages/demobank-ui/src/pages/PaymentOptions.tsx
diff options
context:
space:
mode:
authorSebastian <sebasjm@gmail.com>2023-04-14 14:07:15 -0300
committerSebastian <sebasjm@gmail.com>2023-04-14 14:16:25 -0300
commit5ea22a325c069fe497b2dc8a73d4de69fd8cc27b (patch)
tree7783c8a47c5f645a2c277bb0251863e4d6165dde /packages/demobank-ui/src/pages/PaymentOptions.tsx
parentc3e1a0bb519bf5012781891c15c433841203bce2 (diff)
downloadwallet-core-5ea22a325c069fe497b2dc8a73d4de69fd8cc27b.tar.xz
using new localStorage api, pageState => settings, notifcation using observer api
Diffstat (limited to 'packages/demobank-ui/src/pages/PaymentOptions.tsx')
-rw-r--r--packages/demobank-ui/src/pages/PaymentOptions.tsx18
1 files changed, 6 insertions, 12 deletions
diff --git a/packages/demobank-ui/src/pages/PaymentOptions.tsx b/packages/demobank-ui/src/pages/PaymentOptions.tsx
index e0ad64e64..78e55928d 100644
--- a/packages/demobank-ui/src/pages/PaymentOptions.tsx
+++ b/packages/demobank-ui/src/pages/PaymentOptions.tsx
@@ -17,15 +17,11 @@
import { AmountJson } from "@gnu-taler/taler-util";
import { useTranslationContext } from "@gnu-taler/web-util/lib/index.browser";
import { h, VNode } from "preact";
-import { StateUpdater, useState } from "preact/hooks";
-import {
- notifyError,
- notifyInfo,
- PageStateType,
- usePageContext,
-} from "../context/pageState.js";
+import { useState } from "preact/hooks";
+import { notifyInfo } from "../hooks/notification.js";
import { PaytoWireTransferForm } from "./PaytoWireTransferForm.js";
import { WalletWithdrawForm } from "./WalletWithdrawForm.js";
+import { useSettings } from "../hooks/settings.js";
/**
* Let the user choose a payment option,
@@ -33,7 +29,7 @@ import { WalletWithdrawForm } from "./WalletWithdrawForm.js";
*/
export function PaymentOptions({ limit }: { limit: AmountJson }): VNode {
const { i18n } = useTranslationContext();
- const { pageStateSetter } = usePageContext();
+ const [settings, updateSettings] = useSettings();
const [tab, setTab] = useState<"charge-wallet" | "wire-transfer">(
"charge-wallet",
@@ -66,10 +62,8 @@ export function PaymentOptions({ limit }: { limit: AmountJson }): VNode {
<WalletWithdrawForm
focus
limit={limit}
- onSuccess={(currentWithdrawalOperationId) => {
- pageStateSetter({
- currentWithdrawalOperationId,
- });
+ onSuccess={(id) => {
+ updateSettings("currentWithdrawalOperationId", id);
}}
/>
</div>