diff options
Diffstat (limited to 'packages/demobank-ui/src/pages/HomePage.tsx')
-rw-r--r-- | packages/demobank-ui/src/pages/HomePage.tsx | 29 |
1 files changed, 24 insertions, 5 deletions
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; } |