diff options
author | Sebastian <sebasjm@gmail.com> | 2023-10-30 15:27:25 -0300 |
---|---|---|
committer | Sebastian <sebasjm@gmail.com> | 2023-10-30 15:27:25 -0300 |
commit | 768838285c25cbb1b171f645e8efb37a3c14273a (patch) | |
tree | 3404a7ea452a357baf4ebfc6c3b400f601849744 /packages/demobank-ui/src/pages/UpdateAccountPassword.tsx | |
parent | b7ba3119c1ff0d9ae3432cf0de1ef8cf92fc193c (diff) | |
download | wallet-core-768838285c25cbb1b171f645e8efb37a3c14273a.tar.xz |
local error impl: errors shown fixed position that are wiped when moved from the view
Diffstat (limited to 'packages/demobank-ui/src/pages/UpdateAccountPassword.tsx')
-rw-r--r-- | packages/demobank-ui/src/pages/UpdateAccountPassword.tsx | 9 |
1 files changed, 6 insertions, 3 deletions
diff --git a/packages/demobank-ui/src/pages/UpdateAccountPassword.tsx b/packages/demobank-ui/src/pages/UpdateAccountPassword.tsx index b14c6d90b..d30216f3f 100644 --- a/packages/demobank-ui/src/pages/UpdateAccountPassword.tsx +++ b/packages/demobank-ui/src/pages/UpdateAccountPassword.tsx @@ -1,13 +1,14 @@ -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 { ShowInputErrorLabel } from "../components/ShowInputErrorLabel.js"; import { useBankCoreApiContext } from "../context/config.js"; import { useBackendState } from "../hooks/backend.js"; import { undefinedIfEmpty, withRuntimeErrorHandling } from "../utils.js"; -import { assertUnreachable } from "./WithdrawalOperationPage.js"; import { doAutoFocus } from "./PaytoWireTransferForm.js"; import { ProfileNavigation } from "./ProfileNavigation.js"; +import { assertUnreachable } from "./WithdrawalOperationPage.js"; +import { ShowLocalNotification } from "../components/ShowLocalNotification.js"; export function UpdateAccountPassword({ account: accountName, @@ -41,11 +42,12 @@ export function UpdateAccountPassword({ ? i18n.str`password doesn't match` : undefined, }); + const [notification, notify, handleError] = useLocalNotification() async function doChangePassword() { if (!!errors || !password || !token) return; - await withRuntimeErrorHandling(i18n, async () => { + await handleError(async () => { const resp = await api.updatePassword({ username: accountName, token }, { old_password: current, new_password: password, @@ -77,6 +79,7 @@ export function UpdateAccountPassword({ return ( <Fragment> + <ShowLocalNotification notification={notification} /> {accountIsTheCurrentUser ? <ProfileNavigation current="credentials" /> : <h1 class="text-base font-semibold leading-6 text-gray-900"> |