diff options
author | Sebastian <sebasjm@gmail.com> | 2023-04-14 14:07:15 -0300 |
---|---|---|
committer | Sebastian <sebasjm@gmail.com> | 2023-04-14 14:16:25 -0300 |
commit | 5ea22a325c069fe497b2dc8a73d4de69fd8cc27b (patch) | |
tree | 7783c8a47c5f645a2c277bb0251863e4d6165dde /packages/demobank-ui/src/pages/HomePage.tsx | |
parent | c3e1a0bb519bf5012781891c15c433841203bce2 (diff) | |
download | wallet-core-5ea22a325c069fe497b2dc8a73d4de69fd8cc27b.tar.xz |
using new localStorage api, pageState => settings, notifcation using observer api
Diffstat (limited to 'packages/demobank-ui/src/pages/HomePage.tsx')
-rw-r--r-- | packages/demobank-ui/src/pages/HomePage.tsx | 21 |
1 files changed, 8 insertions, 13 deletions
diff --git a/packages/demobank-ui/src/pages/HomePage.tsx b/packages/demobank-ui/src/pages/HomePage.tsx index 2cdbc49bc..340181a4f 100644 --- a/packages/demobank-ui/src/pages/HomePage.tsx +++ b/packages/demobank-ui/src/pages/HomePage.tsx @@ -27,17 +27,11 @@ import { useTranslationContext, } from "@gnu-taler/web-util/lib/index.browser"; import { Fragment, VNode, h } from "preact"; -import { StateUpdater } from "preact/hooks"; import { Loading } from "../components/Loading.js"; import { useBackendContext } from "../context/backend.js"; -import { - ObservedStateType, - PageStateType, - notifyError, - notifyInfo, - usePageContext, -} from "../context/pageState.js"; import { getInitialBackendBaseURL } from "../hooks/backend.js"; +import { notifyError, notifyInfo } from "../hooks/notification.js"; +import { useSettings } from "../hooks/settings.js"; import { AccountPage } from "./AccountPage.js"; import { AdminPage } from "./AdminPage.js"; import { LoginForm } from "./LoginForm.js"; @@ -63,15 +57,15 @@ export function HomePage({ onRegister: () => void; }): VNode { const backend = useBackendContext(); - const { pageState, pageStateSetter } = usePageContext(); + const [settings] = useSettings(); const { i18n } = useTranslationContext(); if (backend.state.status === "loggedOut") { return <LoginForm onRegister={onRegister} />; } - if (pageState.currentWithdrawalOperationId) { - onPendingOperationFound(pageState.currentWithdrawalOperationId); + if (settings.currentWithdrawalOperationId) { + onPendingOperationFound(settings.currentWithdrawalOperationId); return <Loading />; } @@ -104,9 +98,10 @@ export function WithdrawalOperationPage({ }); const parsedUri = parseWithdrawUri(uri); const { i18n } = useTranslationContext(); - const { pageStateSetter } = usePageContext(); + + const [settings, updateSettings] = useSettings(); function clearCurrentWithdrawal(): void { - pageStateSetter({}); + updateSettings("currentWithdrawalOperationId", undefined); onAbort(); } |