From 768838285c25cbb1b171f645e8efb37a3c14273a Mon Sep 17 00:00:00 2001 From: Sebastian Date: Mon, 30 Oct 2023 15:27:25 -0300 Subject: local error impl: errors shown fixed position that are wiped when moved from the view --- packages/demobank-ui/src/pages/ShowAccountDetails.tsx | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) (limited to 'packages/demobank-ui/src/pages/ShowAccountDetails.tsx') diff --git a/packages/demobank-ui/src/pages/ShowAccountDetails.tsx b/packages/demobank-ui/src/pages/ShowAccountDetails.tsx index b109441a6..eb8ea8f20 100644 --- a/packages/demobank-ui/src/pages/ShowAccountDetails.tsx +++ b/packages/demobank-ui/src/pages/ShowAccountDetails.tsx @@ -1,5 +1,5 @@ import { TalerCorebankApi, TalerError, TranslatedString } from "@gnu-taler/taler-util"; -import { notify, notifyInfo, useTranslationContext } from "@gnu-taler/web-util/browser"; +import { notifyInfo, useLocalNotification, useTranslationContext } from "@gnu-taler/web-util/browser"; import { Fragment, VNode, h } from "preact"; import { useState } from "preact/hooks"; import { ErrorLoading } from "../components/ErrorLoading.js"; @@ -8,10 +8,11 @@ import { useBankCoreApiContext } from "../context/config.js"; import { useAccountDetails } from "../hooks/access.js"; import { useBackendState } from "../hooks/backend.js"; import { undefinedIfEmpty, withRuntimeErrorHandling } from "../utils.js"; -import { assertUnreachable } from "./WithdrawalOperationPage.js"; import { LoginForm } from "./LoginForm.js"; -import { AccountForm } from "./admin/AccountForm.js"; import { ProfileNavigation } from "./ProfileNavigation.js"; +import { assertUnreachable } from "./WithdrawalOperationPage.js"; +import { AccountForm } from "./admin/AccountForm.js"; +import { ShowLocalNotification } from "../components/ShowLocalNotification.js"; export function ShowAccountDetails({ account, @@ -31,6 +32,7 @@ export function ShowAccountDetails({ const [update, setUpdate] = useState(false); const [submitAccount, setSubmitAccount] = useState(); + const [notification, notify, handleError] = useLocalNotification() const result = useAccountDetails(account); if (!result) { @@ -50,7 +52,7 @@ export function ShowAccountDetails({ async function doUpdate() { if (!update || !submitAccount || !creds) return; - await withRuntimeErrorHandling(i18n, async () => { + await handleError(async () => { const resp = await api.updateAccount(creds, { cashout_address: submitAccount.cashout_payto_uri, challenge_contact_data: undefinedIfEmpty({ @@ -93,6 +95,7 @@ export function ShowAccountDetails({ return ( + {accountIsTheCurrentUser ? : -- cgit v1.2.3