From f5771cc7b99dc938fd606dcbee350b66ec8027c9 Mon Sep 17 00:00:00 2001 From: Sebastian Date: Tue, 9 Jan 2024 18:51:49 -0300 Subject: prepare for 2fa impl --- packages/demobank-ui/src/pages/RegistrationPage.tsx | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) (limited to 'packages/demobank-ui/src/pages/RegistrationPage.tsx') diff --git a/packages/demobank-ui/src/pages/RegistrationPage.tsx b/packages/demobank-ui/src/pages/RegistrationPage.tsx index d20c402ac..89bfbcb35 100644 --- a/packages/demobank-ui/src/pages/RegistrationPage.tsx +++ b/packages/demobank-ui/src/pages/RegistrationPage.tsx @@ -13,7 +13,7 @@ You should have received a copy of the GNU General Public License along with GNU Taler; see the file COPYING. If not, see */ -import { AccessToken, Logger, TranslatedString } from "@gnu-taler/taler-util"; +import { AccessToken, HttpStatusCode, Logger, TalerErrorCode, TranslatedString } from "@gnu-taler/taler-util"; import { LocalNotificationBanner, ShowInputErrorLabel, @@ -101,43 +101,43 @@ function RegistrationForm({ onComplete, onCancel }: { onComplete: () => void, on const creationResponse = await api.createAccount("" as AccessToken, { name, username, password }); if (creationResponse.type === "fail") { switch (creationResponse.case) { - case "invalid-phone-or-email": return notify({ + case HttpStatusCode.BadRequest: return notify({ type: "error", title: i18n.str`Server replied with invalid phone or email.`, description: creationResponse.detail.hint as TranslatedString, debug: creationResponse.detail, }) - case "insufficient-funds": return notify({ + case TalerErrorCode.BANK_UNALLOWED_DEBIT: return notify({ type: "error", title: i18n.str`Registration is disabled because the bank ran out of bonus credit.`, description: creationResponse.detail.hint as TranslatedString, debug: creationResponse.detail, }) - case "unauthorized": return notify({ + case HttpStatusCode.Unauthorized: return notify({ type: "error", title: i18n.str`No enough permission to create that account.`, description: creationResponse.detail.hint as TranslatedString, debug: creationResponse.detail, }) - case "payto-already-exists": return notify({ + case TalerErrorCode.BANK_REGISTER_PAYTO_URI_REUSE: return notify({ type: "error", title: i18n.str`That account id is already taken.`, description: creationResponse.detail.hint as TranslatedString, debug: creationResponse.detail, }) - case "username-already-exists": return notify({ + case TalerErrorCode.BANK_REGISTER_USERNAME_REUSE: return notify({ type: "error", title: i18n.str`That username is already taken.`, description: creationResponse.detail.hint as TranslatedString, debug: creationResponse.detail, }) - case "username-reserved": return notify({ + case TalerErrorCode.BANK_RESERVED_USERNAME_CONFLICT: return notify({ type: "error", title: i18n.str`That username can't be used because is reserved.`, description: creationResponse.detail.hint as TranslatedString, debug: creationResponse.detail, }) - case "user-cant-set-debt": return notify({ + case TalerErrorCode.BANK_NON_ADMIN_PATCH_DEBT_LIMIT: return notify({ type: "error", title: i18n.str`Only admin is allow to set debt limit.`, description: creationResponse.detail.hint as TranslatedString, -- cgit v1.2.3