diff options
author | Sebastian <sebasjm@gmail.com> | 2024-01-09 18:51:49 -0300 |
---|---|---|
committer | Sebastian <sebasjm@gmail.com> | 2024-01-09 18:51:49 -0300 |
commit | f5771cc7b99dc938fd606dcbee350b66ec8027c9 (patch) | |
tree | 95c1aa5b8a5e6067c7689b0caf161c50d1f694ed /packages/demobank-ui/src/pages/account/ShowAccountDetails.tsx | |
parent | 1826b9121a0308aa0a7ac39a89ad7dc8ea2ae965 (diff) | |
download | wallet-core-f5771cc7b99dc938fd606dcbee350b66ec8027c9.tar.xz |
prepare for 2fa impl
Diffstat (limited to 'packages/demobank-ui/src/pages/account/ShowAccountDetails.tsx')
-rw-r--r-- | packages/demobank-ui/src/pages/account/ShowAccountDetails.tsx | 21 |
1 files changed, 11 insertions, 10 deletions
diff --git a/packages/demobank-ui/src/pages/account/ShowAccountDetails.tsx b/packages/demobank-ui/src/pages/account/ShowAccountDetails.tsx index 4b66c0d8d..98fb72283 100644 --- a/packages/demobank-ui/src/pages/account/ShowAccountDetails.tsx +++ b/packages/demobank-ui/src/pages/account/ShowAccountDetails.tsx @@ -1,4 +1,4 @@ -import { TalerCorebankApi, TalerError, TranslatedString } from "@gnu-taler/taler-util"; +import { HttpStatusCode, TalerCorebankApi, TalerError, TalerErrorCode, TranslatedString } from "@gnu-taler/taler-util"; import { Loading, LocalNotificationBanner, notifyInfo, useLocalNotification, useTranslationContext } from "@gnu-taler/web-util/browser"; import { Fragment, VNode, h } from "preact"; import { useState } from "preact/hooks"; @@ -40,8 +40,8 @@ export function ShowAccountDetails({ } if (result.type === "fail") { switch (result.case) { - case "not-found": return <LoginForm currentUser={account} /> - case "unauthorized": return <LoginForm currentUser={account} /> + case HttpStatusCode.Unauthorized: + case HttpStatusCode.NotFound: return <LoginForm currentUser={account} /> default: assertUnreachable(result) } } @@ -52,6 +52,7 @@ export function ShowAccountDetails({ const resp = await api.updateAccount({ token: creds.token, username: account, + }, submitAccount); if (resp.type === "ok") { @@ -59,39 +60,39 @@ export function ShowAccountDetails({ onUpdateSuccess(); } else { switch (resp.case) { - case "unauthorized": return notify({ + case HttpStatusCode.Unauthorized: return notify({ type: "error", title: i18n.str`The rights to change the account are not sufficient`, description: resp.detail.hint as TranslatedString, debug: resp.detail, }) - case "not-found": return notify({ + case HttpStatusCode.NotFound: return notify({ type: "error", title: i18n.str`The username was not found`, description: resp.detail.hint as TranslatedString, debug: resp.detail, }) - case "user-cant-change-name": return notify({ + case TalerErrorCode.BANK_NON_ADMIN_PATCH_LEGAL_NAME: return notify({ type: "error", title: i18n.str`You can't change the legal name, please contact the your account administrator.`, description: resp.detail.hint as TranslatedString, debug: resp.detail, }) - case "user-cant-change-debt": return notify({ + case TalerErrorCode.BANK_NON_ADMIN_PATCH_DEBT_LIMIT: return notify({ type: "error", title: i18n.str`You can't change the debt limit, please contact the your account administrator.`, description: resp.detail.hint as TranslatedString, debug: resp.detail, }) - case "user-cant-change-cashout": return notify({ + case TalerErrorCode.BANK_NON_ADMIN_PATCH_CASHOUT: return notify({ type: "error", title: i18n.str`You can't change the cashout address, please contact the your account administrator.`, description: resp.detail.hint as TranslatedString, debug: resp.detail, }) - case "missing-contact-data": return notify({ + case TalerErrorCode.BANK_NON_ADMIN_PATCH_CONTACT: return notify({ type: "error", - title: i18n.str`You need contact data to enable 2FA.`, + title: i18n.str`You can't change the contact data, please contact the your account administrator.`, description: resp.detail.hint as TranslatedString, debug: resp.detail, }) |