From a3aa7d95d09c83794067c47df4a455c0e3f21806 Mon Sep 17 00:00:00 2001
From: Sebastian <sebasjm@gmail.com>
Date: Fri, 7 Apr 2023 17:30:01 -0300
Subject: anon withdrawal confirmation, and fix error with infinity loop

---
 .../demobank-ui/src/pages/PaytoWireTransferForm.tsx  | 20 +++++++++-----------
 1 file changed, 9 insertions(+), 11 deletions(-)

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

diff --git a/packages/demobank-ui/src/pages/PaytoWireTransferForm.tsx b/packages/demobank-ui/src/pages/PaytoWireTransferForm.tsx
index 027f8e25a..5f16fbf6b 100644
--- a/packages/demobank-ui/src/pages/PaytoWireTransferForm.tsx
+++ b/packages/demobank-ui/src/pages/PaytoWireTransferForm.tsx
@@ -29,7 +29,11 @@ import {
 } from "@gnu-taler/web-util/lib/index.browser";
 import { h, VNode } from "preact";
 import { useEffect, useRef, useState } from "preact/hooks";
-import { PageStateType } from "../context/pageState.js";
+import {
+  notifyError,
+  ObservedStateType,
+  PageStateType,
+} from "../context/pageState.js";
 import { useAccessAPI } from "../hooks/access.js";
 import {
   buildRequestErrorMessage,
@@ -42,20 +46,14 @@ const logger = new Logger("PaytoWireTransferForm");
 
 export function PaytoWireTransferForm({
   focus,
-  onError,
   onSuccess,
   limit,
 }: {
   focus?: boolean;
-  onError: (e: PageStateType["error"]) => void;
   onSuccess: () => void;
   limit: AmountJson;
 }): VNode {
-  // const backend = useBackendContext();
-  // const { pageState, pageStateSetter } = usePageContext(); // NOTE: used for go-back button?
-
   const [isRawPayto, setIsRawPayto] = useState(false);
-  // const [submitData, submitDataSetter] = useWireTransferRequestType();
   const [iban, setIban] = useState<string | undefined>(undefined);
   const [subject, setSubject] = useState<string | undefined>(undefined);
   const [amount, setAmount] = useState<string | undefined>(undefined);
@@ -201,7 +199,7 @@ export function PaytoWireTransferForm({
                   setSubject(undefined);
                 } catch (error) {
                   if (error instanceof RequestError) {
-                    onError(
+                    notifyError(
                       buildRequestErrorMessage(i18n, error.cause, {
                         onClientError: (status) =>
                           status === HttpStatusCode.BadRequest
@@ -210,7 +208,7 @@ export function PaytoWireTransferForm({
                       }),
                     );
                   } else {
-                    onError({
+                    notifyError({
                       title: i18n.str`Operation failed, please report`,
                       description:
                         error instanceof Error
@@ -330,7 +328,7 @@ export function PaytoWireTransferForm({
                 rawPaytoInputSetter(undefined);
               } catch (error) {
                 if (error instanceof RequestError) {
-                  onError(
+                  notifyError(
                     buildRequestErrorMessage(i18n, error.cause, {
                       onClientError: (status) =>
                         status === HttpStatusCode.BadRequest
@@ -339,7 +337,7 @@ export function PaytoWireTransferForm({
                     }),
                   );
                 } else {
-                  onError({
+                  notifyError({
                     title: i18n.str`Operation failed, please report`,
                     description:
                       error instanceof Error
-- 
cgit v1.2.3

