aboutsummaryrefslogtreecommitdiff
path: root/packages/demobank-ui/src/pages/admin
diff options
context:
space:
mode:
Diffstat (limited to 'packages/demobank-ui/src/pages/admin')
-rw-r--r--packages/demobank-ui/src/pages/admin/AccountForm.tsx6
-rw-r--r--packages/demobank-ui/src/pages/admin/AccountList.tsx4
-rw-r--r--packages/demobank-ui/src/pages/admin/CreateNewAccount.tsx18
-rw-r--r--packages/demobank-ui/src/pages/admin/RemoveAccount.tsx14
4 files changed, 21 insertions, 21 deletions
diff --git a/packages/demobank-ui/src/pages/admin/AccountForm.tsx b/packages/demobank-ui/src/pages/admin/AccountForm.tsx
index c64431918..859c04396 100644
--- a/packages/demobank-ui/src/pages/admin/AccountForm.tsx
+++ b/packages/demobank-ui/src/pages/admin/AccountForm.tsx
@@ -66,7 +66,7 @@ export function AccountForm<PurposeType extends keyof ChangeByPurposeType>({
const defaultValue: AccountFormData = {
- debit_threshold: Amounts.stringifyValue(template?.debit_threshold ??config.default_debit_threshold),
+ debit_threshold: Amounts.stringifyValue(template?.debit_threshold ?? config.default_debit_threshold),
isExchange: template?.is_taler_exchange,
isPublic: template?.is_public,
name: template?.name ?? "",
@@ -418,13 +418,13 @@ export function AccountForm<PurposeType extends keyof ChangeByPurposeType>({
<i18n.Translate>Is public</i18n.Translate>
</span>
</span>
- <button type="button" data-enabled={form.isPublic ?? defaultValue.isPublic ? "true" : "false"} class="bg-indigo-600 data-[enabled=false]:bg-gray-200 relative inline-flex h-6 w-11 flex-shrink-0 cursor-pointer rounded-full border-2 border-transparent transition-colors duration-200 ease-in-out focus:outline-none focus:ring-2 focus:ring-indigo-600 focus:ring-offset-2" role="switch" aria-checked="false" aria-labelledby="availability-label" aria-describedby="availability-description"
+ <button type="button" data-enabled={form.isPublic ?? defaultValue.isPublic ? "true" : "false"} class="bg-indigo-600 data-[enabled=false]:bg-gray-200 relative inline-flex h-6 w-11 flex-shrink-0 cursor-pointer rounded-full border-2 border-transparent transition-colors duration-200 ease-in-out focus:outline-none focus:ring-2 focus:ring-indigo-600 focus:ring-offset-2" role="switch" aria-checked="false" aria-labelledby="availability-label" aria-describedby="availability-description"
onClick={() => {
form.isPublic = !form.isPublic
updateForm(structuredClone(form))
}}>
- <span aria-hidden="true" data-enabled={form.isPublic ?? defaultValue.isPublic ? "true" : "false"} class="translate-x-5 data-[enabled=false]:translate-x-0 pointer-events-none inline-block h-5 w-5 transform rounded-full bg-white shadow ring-0 transition duration-200 ease-in-out"></span>
+ <span aria-hidden="true" data-enabled={form.isPublic ?? defaultValue.isPublic ? "true" : "false"} class="translate-x-5 data-[enabled=false]:translate-x-0 pointer-events-none inline-block h-5 w-5 transform rounded-full bg-white shadow ring-0 transition duration-200 ease-in-out"></span>
</button>
</div>
<p class="mt-2 text-sm text-gray-500" >
diff --git a/packages/demobank-ui/src/pages/admin/AccountList.tsx b/packages/demobank-ui/src/pages/admin/AccountList.tsx
index 42d3d7fca..dd4586697 100644
--- a/packages/demobank-ui/src/pages/admin/AccountList.tsx
+++ b/packages/demobank-ui/src/pages/admin/AccountList.tsx
@@ -1,4 +1,4 @@
-import { Amounts, TalerError } from "@gnu-taler/taler-util";
+import { Amounts, HttpStatusCode, TalerError } from "@gnu-taler/taler-util";
import { Loading, useTranslationContext } from "@gnu-taler/web-util/browser";
import { Fragment, VNode, h } from "preact";
import { ErrorLoadingWithDebug } from "../../components/ErrorLoadingWithDebug.js";
@@ -29,7 +29,7 @@ export function AccountList({ onRemoveAccount, onShowAccountDetails, onUpdateAcc
}
if (result.data.type === "fail") {
switch (result.data.case) {
- case "unauthorized": return <Fragment />
+ case HttpStatusCode.Unauthorized: return <Fragment />
default: assertUnreachable(result.data.case)
}
}
diff --git a/packages/demobank-ui/src/pages/admin/CreateNewAccount.tsx b/packages/demobank-ui/src/pages/admin/CreateNewAccount.tsx
index 3d196973e..d6b7d5b1e 100644
--- a/packages/demobank-ui/src/pages/admin/CreateNewAccount.tsx
+++ b/packages/demobank-ui/src/pages/admin/CreateNewAccount.tsx
@@ -1,4 +1,4 @@
-import { TalerCorebankApi, TranslatedString } from "@gnu-taler/taler-util";
+import { HttpStatusCode, TalerCorebankApi, TalerErrorCode, TranslatedString } from "@gnu-taler/taler-util";
import { Attention, LocalNotificationBanner, notifyInfo, useLocalNotification, useTranslationContext } from "@gnu-taler/web-util/browser";
import { Fragment, VNode, h } from "preact";
import { useState } from "preact/hooks";
@@ -48,43 +48,43 @@ export function CreateNewAccount({
onCreateSuccess();
} else {
switch (resp.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`,
+ title: i18n.str`Server replied that phone or email is invalid`,
description: resp.detail.hint as TranslatedString,
debug: resp.detail,
})
- case "unauthorized": return notify({
+ case HttpStatusCode.Unauthorized: return notify({
type: "error",
title: i18n.str`The rights to perform the operation are not sufficient`,
description: resp.detail.hint as TranslatedString,
debug: resp.detail,
})
- case "username-already-exists": return notify({
+ case TalerErrorCode.BANK_REGISTER_USERNAME_REUSE: return notify({
type: "error",
title: i18n.str`Account username is already taken`,
description: resp.detail.hint as TranslatedString,
debug: resp.detail,
})
- case "payto-already-exists": return notify({
+ case TalerErrorCode.BANK_REGISTER_PAYTO_URI_REUSE: return notify({
type: "error",
title: i18n.str`Account id is already taken`,
description: resp.detail.hint as TranslatedString,
debug: resp.detail,
})
- case "insufficient-funds": return notify({
+ case TalerErrorCode.BANK_UNALLOWED_DEBIT: return notify({
type: "error",
title: i18n.str`Bank ran out of bonus credit.`,
description: resp.detail.hint as TranslatedString,
debug: resp.detail,
})
- case "username-reserved": return notify({
+ case TalerErrorCode.BANK_RESERVED_USERNAME_CONFLICT: return notify({
type: "error",
title: i18n.str`Account username can't be used because is reserved`,
description: resp.detail.hint as TranslatedString,
debug: resp.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: resp.detail.hint as TranslatedString,
diff --git a/packages/demobank-ui/src/pages/admin/RemoveAccount.tsx b/packages/demobank-ui/src/pages/admin/RemoveAccount.tsx
index 0d294a3a6..d47f48dd9 100644
--- a/packages/demobank-ui/src/pages/admin/RemoveAccount.tsx
+++ b/packages/demobank-ui/src/pages/admin/RemoveAccount.tsx
@@ -1,4 +1,4 @@
-import { Amounts, TalerError, TranslatedString } from "@gnu-taler/taler-util";
+import { Amounts, HttpStatusCode, TalerError, TalerErrorCode, TranslatedString } from "@gnu-taler/taler-util";
import { Attention, Loading, LocalNotificationBanner, ShowInputErrorLabel, notifyInfo, useLocalNotification, useTranslationContext } from "@gnu-taler/web-util/browser";
import { Fragment, VNode, h } from "preact";
import { useState } from "preact/hooks";
@@ -39,8 +39,8 @@ export function RemoveAccount({
}
if (result.type === "fail") {
switch (result.case) {
- case "unauthorized": return <LoginForm currentUser={account} />
- case "not-found": return <LoginForm currentUser={account} />
+ case HttpStatusCode.Unauthorized: return <LoginForm currentUser={account} />
+ case HttpStatusCode.NotFound: return <LoginForm currentUser={account} />
default: assertUnreachable(result)
}
}
@@ -65,25 +65,25 @@ export function RemoveAccount({
onUpdateSuccess();
} else {
switch (resp.case) {
- case "unauthorized": return notify({
+ case HttpStatusCode.Unauthorized: return notify({
type: "error",
title: i18n.str`No enough permission to delete the account.`,
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 "username-reserved": return notify({
+ case TalerErrorCode.BANK_RESERVED_USERNAME_CONFLICT: return notify({
type: "error",
title: i18n.str`Can't delete a reserved username.`,
description: resp.detail.hint as TranslatedString,
debug: resp.detail,
})
- case "balance-not-zero": return notify({
+ case TalerErrorCode.BANK_ACCOUNT_BALANCE_NOT_ZERO: return notify({
type: "error",
title: i18n.str`Can't delete an account with balance different than zero.`,
description: resp.detail.hint as TranslatedString,