From 9922192b0dba2e479b5af3e29c1d44b98e4d29d7 Mon Sep 17 00:00:00 2001
From: Sebastian <sebasjm@gmail.com>
Date: Tue, 28 Feb 2023 19:03:43 -0300
Subject: fix #7729

---
 packages/demobank-ui/src/pages/HomePage.tsx | 29 ++++++++++++++++++++++++-----
 1 file changed, 24 insertions(+), 5 deletions(-)

(limited to 'packages/demobank-ui/src/pages/HomePage.tsx')

diff --git a/packages/demobank-ui/src/pages/HomePage.tsx b/packages/demobank-ui/src/pages/HomePage.tsx
index a360bd64c..7ef4284bf 100644
--- a/packages/demobank-ui/src/pages/HomePage.tsx
+++ b/packages/demobank-ui/src/pages/HomePage.tsx
@@ -14,11 +14,10 @@
  GNU Taler; see the file COPYING.  If not, see <http://www.gnu.org/licenses/>
  */
 
-import { HttpStatusCode, Logger } from "@gnu-taler/taler-util";
+import { Logger } from "@gnu-taler/taler-util";
 import {
   ErrorType,
   HttpResponsePaginated,
-  RequestError,
   useTranslationContext,
 } from "@gnu-taler/web-util/lib/index.browser";
 import { Fragment, h, VNode } from "preact";
@@ -79,7 +78,27 @@ export function HomePage({ onRegister }: { onRegister: () => void }): VNode {
         account={backend.state.username}
         withdrawalId={withdrawalId}
         talerWithdrawUri={talerWithdrawUri}
-        onAbort={clearCurrentWithdrawal}
+        onConfirmed={() => {
+          pageStateSetter((prevState) => {
+            const { talerWithdrawUri, ...rest } = prevState;
+            // remove talerWithdrawUri and add info
+            return {
+              ...rest,
+              info: i18n.str`Withdrawal confirmed!`,
+            };
+          });
+        }}
+        onError={(error) => {
+          pageStateSetter((prevState) => {
+            const { talerWithdrawUri, ...rest } = prevState;
+            // remove talerWithdrawUri and add error
+            return {
+              ...rest,
+              error,
+            };
+          });
+        }}
+        onAborted={clearCurrentWithdrawal}
         onLoadNotOk={handleNotOkResult(
           backend.state.username,
           saveError,
@@ -147,7 +166,7 @@ function handleNotOkResult(
           break;
         }
         case ErrorType.CLIENT: {
-          const errorData = result.error;
+          const errorData = result.payload;
           onErrorHandler({
             title: i18n.str`Could not load due to a client error`,
             description: errorData.error.description,
@@ -168,7 +187,7 @@ function handleNotOkResult(
           onErrorHandler({
             title: i18n.str`Unexpected error.`,
             description: `Diagnostic from ${result.info?.url} is "${result.message}"`,
-            debug: JSON.stringify(result.error),
+            debug: JSON.stringify(result.exception),
           });
           break;
         }
-- 
cgit v1.2.3

