diff options
author | Sebastian <sebasjm@gmail.com> | 2023-04-07 17:30:01 -0300 |
---|---|---|
committer | Sebastian <sebasjm@gmail.com> | 2023-04-07 17:30:01 -0300 |
commit | a3aa7d95d09c83794067c47df4a455c0e3f21806 (patch) | |
tree | 00837196305227fe6f7cbc7289f96b256d5de089 /packages/demobank-ui/src/pages/AccountPage.tsx | |
parent | 43ae414a55b84b1125c5e4377c6d485ca6c748e2 (diff) | |
download | wallet-core-a3aa7d95d09c83794067c47df4a455c0e3f21806.tar.xz |
anon withdrawal confirmation, and fix error with infinity loop
Diffstat (limited to 'packages/demobank-ui/src/pages/AccountPage.tsx')
-rw-r--r-- | packages/demobank-ui/src/pages/AccountPage.tsx | 20 |
1 files changed, 19 insertions, 1 deletions
diff --git a/packages/demobank-ui/src/pages/AccountPage.tsx b/packages/demobank-ui/src/pages/AccountPage.tsx index c6ec7c88e..bab8cca16 100644 --- a/packages/demobank-ui/src/pages/AccountPage.tsx +++ b/packages/demobank-ui/src/pages/AccountPage.tsx @@ -14,15 +14,21 @@ GNU Taler; see the file COPYING. If not, see <http://www.gnu.org/licenses/> */ -import { Amounts, parsePaytoUri } from "@gnu-taler/taler-util"; +import { Amounts, HttpStatusCode, parsePaytoUri } from "@gnu-taler/taler-util"; import { + ErrorType, HttpResponsePaginated, useTranslationContext, } from "@gnu-taler/web-util/lib/index.browser"; import { Fragment, h, VNode } from "preact"; +import { Loading } from "../components/Loading.js"; import { Transactions } from "../components/Transactions/index.js"; +import { PageStateType, notifyError } from "../context/pageState.js"; import { useAccountDetails } from "../hooks/access.js"; +import { LoginForm } from "./LoginForm.js"; import { PaymentOptions } from "./PaymentOptions.js"; +import { StateUpdater } from "preact/hooks"; +import { useBackendContext } from "../context/backend.js"; interface Props { account: string; @@ -35,9 +41,21 @@ interface Props { */ export function AccountPage({ account, onLoadNotOk }: Props): VNode { const result = useAccountDetails(account); + const backend = useBackendContext(); const { i18n } = useTranslationContext(); if (!result.ok) { + if (result.loading || result.type === ErrorType.TIMEOUT) { + return onLoadNotOk(result); + } + //logout if there is any error, not if loading + backend.logOut(); + if (result.status === HttpStatusCode.NotFound) { + notifyError({ + title: i18n.str`Username or account label "${account}" not found`, + }); + return <LoginForm />; + } return onLoadNotOk(result); } |