diff options
author | Sebastian <sebasjm@gmail.com> | 2023-10-30 15:27:25 -0300 |
---|---|---|
committer | Sebastian <sebasjm@gmail.com> | 2023-10-30 15:27:25 -0300 |
commit | 768838285c25cbb1b171f645e8efb37a3c14273a (patch) | |
tree | 3404a7ea452a357baf4ebfc6c3b400f601849744 /packages/demobank-ui/src/pages/WithdrawalConfirmationQuestion.tsx | |
parent | b7ba3119c1ff0d9ae3432cf0de1ef8cf92fc193c (diff) | |
download | wallet-core-768838285c25cbb1b171f645e8efb37a3c14273a.tar.gz wallet-core-768838285c25cbb1b171f645e8efb37a3c14273a.tar.bz2 wallet-core-768838285c25cbb1b171f645e8efb37a3c14273a.zip |
local error impl: errors shown fixed position that are wiped when moved from the view
Diffstat (limited to 'packages/demobank-ui/src/pages/WithdrawalConfirmationQuestion.tsx')
-rw-r--r-- | packages/demobank-ui/src/pages/WithdrawalConfirmationQuestion.tsx | 23 |
1 files changed, 11 insertions, 12 deletions
diff --git a/packages/demobank-ui/src/pages/WithdrawalConfirmationQuestion.tsx b/packages/demobank-ui/src/pages/WithdrawalConfirmationQuestion.tsx index 5e0fa322f..89538e305 100644 --- a/packages/demobank-ui/src/pages/WithdrawalConfirmationQuestion.tsx +++ b/packages/demobank-ui/src/pages/WithdrawalConfirmationQuestion.tsx @@ -16,32 +16,28 @@ import { AmountJson, - Amounts, - HttpStatusCode, Logger, PaytoUri, PaytoUriIBAN, PaytoUriTalerBank, - TalerError, TranslatedString, WithdrawUriResult } from "@gnu-taler/taler-util"; import { - RequestError, - notify, - notifyError, notifyInfo, - useTranslationContext, + useLocalNotification, + useTranslationContext } from "@gnu-taler/web-util/browser"; import { Fragment, VNode, h } from "preact"; import { useMemo, useState } from "preact/hooks"; +import { mutate } from "swr"; import { ShowInputErrorLabel } from "../components/ShowInputErrorLabel.js"; -import { buildRequestErrorMessage, undefinedIfEmpty, withRuntimeErrorHandling } from "../utils.js"; +import { useBankCoreApiContext } from "../context/config.js"; import { useSettings } from "../hooks/settings.js"; +import { undefinedIfEmpty, withRuntimeErrorHandling } from "../utils.js"; import { RenderAmount } from "./PaytoWireTransferForm.js"; -import { useBankCoreApiContext } from "../context/config.js"; import { assertUnreachable } from "./WithdrawalOperationPage.js"; -import { mutate } from "swr"; +import { ShowLocalNotification } from "../components/ShowLocalNotification.js"; const logger = new Logger("WithdrawalConfirmationQuestion"); @@ -72,6 +68,7 @@ export function WithdrawalConfirmationQuestion({ b: Math.floor(Math.random() * 10), }; }, []); + const [notification, notify, handleError] = useLocalNotification() const { api } = useBankCoreApiContext() const [captchaAnswer, setCaptchaAnswer] = useState<string | undefined>(); @@ -89,7 +86,7 @@ export function WithdrawalConfirmationQuestion({ async function doTransfer() { setBusy({}) - await withRuntimeErrorHandling(i18n, async () => { + await handleError(async () => { const resp = await api.confirmWithdrawalById(withdrawUri.withdrawalOperationId); if (resp.type === "ok") { mutate(() => true)// clean any info that we have @@ -131,7 +128,7 @@ export function WithdrawalConfirmationQuestion({ async function doCancel() { setBusy({}) - await withRuntimeErrorHandling(i18n, async () => { + await handleError(async () => { const resp = await api.abortWithdrawalById(withdrawUri.withdrawalOperationId); if (resp.type === "ok") { onAborted(); @@ -164,6 +161,8 @@ export function WithdrawalConfirmationQuestion({ return ( <Fragment> + <ShowLocalNotification notification={notification} /> + <div class="bg-white shadow sm:rounded-lg"> <div class="px-4 py-5 sm:p-6"> <h3 class="text-base font-semibold text-gray-900"> |