diff options
author | Sebastian <sebasjm@gmail.com> | 2023-10-19 15:10:18 -0300 |
---|---|---|
committer | Sebastian <sebasjm@gmail.com> | 2023-10-19 15:10:18 -0300 |
commit | 7582855e2723e11de25f10b6d5ba8a0757616765 (patch) | |
tree | 320f30c7202c88ba63542b93de1cbda533a73356 /packages/demobank-ui/src/pages/WalletWithdrawForm.tsx | |
parent | 9e925a2f56677600973c4659f82776a6a56339bb (diff) | |
download | wallet-core-7582855e2723e11de25f10b6d5ba8a0757616765.tar.gz wallet-core-7582855e2723e11de25f10b6d5ba8a0757616765.tar.bz2 wallet-core-7582855e2723e11de25f10b6d5ba8a0757616765.zip |
some ui fixes
Diffstat (limited to 'packages/demobank-ui/src/pages/WalletWithdrawForm.tsx')
-rw-r--r-- | packages/demobank-ui/src/pages/WalletWithdrawForm.tsx | 18 |
1 files changed, 4 insertions, 14 deletions
diff --git a/packages/demobank-ui/src/pages/WalletWithdrawForm.tsx b/packages/demobank-ui/src/pages/WalletWithdrawForm.tsx index 2d80bad1f..28d5d7749 100644 --- a/packages/demobank-ui/src/pages/WalletWithdrawForm.tsx +++ b/packages/demobank-ui/src/pages/WalletWithdrawForm.tsx @@ -36,7 +36,7 @@ import { Attention } from "../components/Attention.js"; import { useBankCoreApiContext } from "../context/config.js"; import { useBackendState } from "../hooks/backend.js"; import { useSettings } from "../hooks/settings.js"; -import { buildRequestErrorMessage, undefinedIfEmpty } from "../utils.js"; +import { buildRequestErrorMessage, undefinedIfEmpty, withRuntimeErrorHandling } from "../utils.js"; import { assertUnreachable } from "./HomePage.js"; import { OperationState } from "./OperationState/index.js"; import { InputAmount, doAutoFocus } from "./PaytoWireTransferForm.js"; @@ -62,6 +62,7 @@ function OldWithdrawalForm({ goToConfirmOperation, limit, onCancel, focus }: { if (!!settings.currentWithdrawalOperationId) { return <Attention type="warning" title={i18n.str`There is an operation already`}> + <span ref={focus ? doAutoFocus : undefined}/> <i18n.Translate> To complete or cancel the operation click <a class="font-semibold text-yellow-700 hover:text-yellow-600" href={`#/operation/${settings.currentWithdrawalOperationId}`}>here</a> </i18n.Translate> @@ -87,7 +88,7 @@ function OldWithdrawalForm({ goToConfirmOperation, limit, onCancel, focus }: { async function doStart() { if (!parsedAmount || !creds) return; - try { + await withRuntimeErrorHandling(i18n, async () => { const result = await api.createWithdrawal(creds, { amount: Amounts.stringify(parsedAmount), }); @@ -110,18 +111,7 @@ function OldWithdrawalForm({ goToConfirmOperation, limit, onCancel, focus }: { default: assertUnreachable(result.case) } } - } catch (error) { - if (error instanceof TalerError) { - notify(buildRequestErrorMessage(i18n, error)) - } else { - notifyError( - i18n.str`Operation failed, please report`, - (error instanceof Error - ? error.message - : JSON.stringify(error)) as TranslatedString - ) - } - } + }) } return <form |