diff options
Diffstat (limited to 'packages/exchange-backoffice-ui/src/pages/CreateAccount.tsx')
-rw-r--r-- | packages/exchange-backoffice-ui/src/pages/CreateAccount.tsx | 29 |
1 files changed, 21 insertions, 8 deletions
diff --git a/packages/exchange-backoffice-ui/src/pages/CreateAccount.tsx b/packages/exchange-backoffice-ui/src/pages/CreateAccount.tsx index 41a1d20ff..5dcb8b21d 100644 --- a/packages/exchange-backoffice-ui/src/pages/CreateAccount.tsx +++ b/packages/exchange-backoffice-ui/src/pages/CreateAccount.tsx @@ -1,5 +1,8 @@ import { TranslatedString } from "@gnu-taler/taler-util"; -import { useTranslationContext } from "@gnu-taler/web-util/browser"; +import { + notifyError, + useTranslationContext, +} from "@gnu-taler/web-util/browser"; import { VNode, h } from "preact"; import { createNewForm } from "../handlers/forms.js"; @@ -41,16 +44,26 @@ export function CreateAccount({ : undefined, }, repeat: { - // error: !v.repeat - // ? i18n.str`required` - // // : v.repeat !== v.password - // // ? i18n.str`doesn't match` - // : undefined, + error: !v.repeat + ? i18n.str`required` + : v.repeat !== v.password + ? i18n.str`doesn't match` + : undefined, }, }; }} - onSubmit={async (v) => { - onNewAccount(v.password); + onSubmit={async (v, s) => { + console.log(v, s); + const error = s?.password?.error ?? s?.repeat?.error; + console.log(error); + if (error) { + notifyError( + "Can't create account" as TranslatedString, + error as TranslatedString, + ); + } else { + onNewAccount(v.password!); + } }} > <div class="mb-4"> |