[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[taler-wallet-core] branch master updated: fix #7819
From: |
gnunet |
Subject: |
[taler-wallet-core] branch master updated: fix #7819 |
Date: |
Wed, 26 Apr 2023 19:47:48 +0200 |
This is an automated email from the git hooks/post-receive script.
sebasjm pushed a commit to branch master
in repository wallet-core.
The following commit(s) were added to refs/heads/master by this push:
new 93e8010b5 fix #7819
93e8010b5 is described below
commit 93e8010b5a30a0d4b61fb3e0c06c8eb602e30f2f
Author: Sebastian <sebasjm@gmail.com>
AuthorDate: Wed Apr 26 14:47:42 2023 -0300
fix #7819
---
packages/demobank-ui/src/pages/QrCodeSection.tsx | 42 ++++++++++++++++++++++--
1 file changed, 39 insertions(+), 3 deletions(-)
diff --git a/packages/demobank-ui/src/pages/QrCodeSection.tsx
b/packages/demobank-ui/src/pages/QrCodeSection.tsx
index 919f2b1fe..dc92576fb 100644
--- a/packages/demobank-ui/src/pages/QrCodeSection.tsx
+++ b/packages/demobank-ui/src/pages/QrCodeSection.tsx
@@ -14,11 +14,21 @@
GNU Taler; see the file COPYING. If not, see <http://www.gnu.org/licenses/>
*/
-import { stringifyWithdrawUri, WithdrawUriResult } from
"@gnu-taler/taler-util";
-import { useTranslationContext } from "@gnu-taler/web-util/lib/index.browser";
+import {
+ HttpStatusCode,
+ stringifyWithdrawUri,
+ WithdrawUriResult,
+} from "@gnu-taler/taler-util";
+import {
+ RequestError,
+ useTranslationContext,
+} from "@gnu-taler/web-util/lib/index.browser";
import { h, VNode } from "preact";
import { useEffect } from "preact/hooks";
import { QR } from "../components/QR.js";
+import { useAccessAnonAPI } from "../hooks/access.js";
+import { notifyError } from "../hooks/notification.js";
+import { buildRequestErrorMessage } from "../utils.js";
export function QrCodeSection({
withdrawUri,
@@ -38,6 +48,7 @@ export function QrCodeSection({
}, []);
const talerWithdrawUri = stringifyWithdrawUri(withdrawUri);
+ const { abortWithdrawal } = useAccessAnonAPI();
return (
<section id="main" class="content">
<h1 class="nav">{i18n.str`Transfer to Taler Wallet`}</h1>
@@ -55,7 +66,32 @@ export function QrCodeSection({
<br />
<a
class="pure-button btn-cancel"
- onClick={onAborted}
+ onClick={async (e) => {
+ e.preventDefault();
+ try {
+ await abortWithdrawal(withdrawUri.withdrawalOperationId);
+ onAborted();
+ } catch (error) {
+ if (error instanceof RequestError) {
+ notifyError(
+ buildRequestErrorMessage(i18n, error.cause, {
+ onClientError: (status) =>
+ status === HttpStatusCode.Conflict
+ ? i18n.str`The reserve operation has been confirmed
previously and can't be aborted`
+ : undefined,
+ }),
+ );
+ } else {
+ notifyError({
+ title: i18n.str`Operation failed, please report`,
+ description:
+ error instanceof Error
+ ? error.message
+ : JSON.stringify(error),
+ });
+ }
+ }
+ }}
>{i18n.str`Abort`}</a>
</div>
</article>
--
To stop receiving notification emails like this one, please contact
gnunet@gnunet.org.
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [taler-wallet-core] branch master updated: fix #7819,
gnunet <=