aboutsummaryrefslogtreecommitdiff
path: root/packages/demobank-ui/src/pages/OperationState/views.tsx
diff options
context:
space:
mode:
Diffstat (limited to 'packages/demobank-ui/src/pages/OperationState/views.tsx')
-rw-r--r--packages/demobank-ui/src/pages/OperationState/views.tsx30
1 files changed, 15 insertions, 15 deletions
diff --git a/packages/demobank-ui/src/pages/OperationState/views.tsx b/packages/demobank-ui/src/pages/OperationState/views.tsx
index b1f09ba2a..a02bb3bbd 100644
--- a/packages/demobank-ui/src/pages/OperationState/views.tsx
+++ b/packages/demobank-ui/src/pages/OperationState/views.tsx
@@ -14,7 +14,7 @@
GNU Taler; see the file COPYING. If not, see <http://www.gnu.org/licenses/>
*/
-import { TranslatedString, stringifyWithdrawUri } from "@gnu-taler/taler-util";
+import { HttpStatusCode, TalerErrorCode, TranslatedString, stringifyWithdrawUri } from "@gnu-taler/taler-util";
import { Attention, LocalNotificationBanner, ShowInputErrorLabel, notifyInfo, useLocalNotification, useTranslationContext } from "@gnu-taler/web-util/browser";
import { Fragment, VNode, h } from "preact";
import { useEffect, useMemo, useState } from "preact/hooks";
@@ -70,19 +70,19 @@ export function NeedConfirmationView({ error, onAbort: doAbort, onConfirm: doCon
const resp = await doAbort()
if (!resp) return;
switch (resp.case) {
- case "previously-confirmed": return notify({
+ case HttpStatusCode.Conflict: return notify({
type: "error",
title: i18n.str`The reserve operation has been confirmed previously and can't be aborted`,
description: resp.detail.hint as TranslatedString,
debug: resp.detail,
})
- case "invalid-id": return notify({
+ case HttpStatusCode.BadRequest: return notify({
type: "error",
title: i18n.str`The operation id is invalid.`,
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 operation was not found.`,
description: resp.detail.hint as TranslatedString,
@@ -104,31 +104,31 @@ export function NeedConfirmationView({ error, onAbort: doAbort, onConfirm: doCon
return
}
switch (hasError.case) {
- case "previously-aborted": return notify({
+ case TalerErrorCode.BANK_CONFIRM_ABORT_CONFLICT: return notify({
type: "error",
title: i18n.str`The withdrawal has been aborted previously and can't be confirmed`,
description: hasError.detail.hint as TranslatedString,
debug: hasError.detail,
})
- case "no-exchange-or-reserve-selected": return notify({
+ case TalerErrorCode.BANK_CONFIRM_INCOMPLETE: return notify({
type: "error",
title: i18n.str`The withdraw operation cannot be confirmed because no exchange and reserve public key selection happened before`,
description: hasError.detail.hint as TranslatedString,
debug: hasError.detail,
})
- case "invalid-id": return notify({
+ case HttpStatusCode.BadRequest: return notify({
type: "error",
title: i18n.str`The operation id is invalid.`,
description: hasError.detail.hint as TranslatedString,
debug: hasError.detail,
});
- case "not-found": return notify({
+ case HttpStatusCode.NotFound: return notify({
type: "error",
title: i18n.str`The operation was not found.`,
description: hasError.detail.hint as TranslatedString,
debug: hasError.detail,
});
- case "insufficient-funds": return notify({
+ case TalerErrorCode.BANK_UNALLOWED_DEBIT: return notify({
type: "error",
title: i18n.str`Your balance is not enough.`,
description: hasError.detail.hint as TranslatedString,
@@ -215,19 +215,19 @@ export function NeedConfirmationView({ error, onAbort: doAbort, onConfirm: doCon
export function FailedView({ error }: State.Failed) {
const { i18n } = useTranslationContext();
switch (error.case) {
- case "unauthorized": return <Attention type="danger"
+ case HttpStatusCode.Unauthorized: return <Attention type="danger"
title={i18n.str`Unauthorized to make the operation, maybe the session has expired or the password changed.`}>
<div class="mt-2 text-sm text-red-700">
{error.detail.hint}
</div>
</Attention>
- case "insufficient-funds": return <Attention type="danger"
+ case HttpStatusCode.Conflict: return <Attention type="danger"
title={i18n.str`The operation was rejected due to insufficient funds.`}>
<div class="mt-2 text-sm text-red-700">
{error.detail.hint}
</div>
</Attention>
- case "account-not-found": return <Attention type="danger"
+ case HttpStatusCode.NotFound: return <Attention type="danger"
title={i18n.str`The operation was rejected due to insufficient funds.`}>
<div class="mt-2 text-sm text-red-700">
{error.detail.hint}
@@ -322,19 +322,19 @@ export function ReadyView({ uri, onClose: doClose }: State.Ready): VNode<{}> {
const hasError = await doClose()
if (!hasError) return;
switch (hasError.case) {
- case "previously-confirmed": return notify({
+ case HttpStatusCode.Conflict: return notify({
type: "error",
title: i18n.str`The reserve operation has been confirmed previously and can't be aborted`,
description: hasError.detail.hint as TranslatedString,
debug: hasError.detail,
})
- case "invalid-id": return notify({
+ case HttpStatusCode.BadRequest: return notify({
type: "error",
title: i18n.str`The operation id is invalid.`,
description: hasError.detail.hint as TranslatedString,
debug: hasError.detail,
});
- case "not-found": return notify({
+ case HttpStatusCode.NotFound: return notify({
type: "error",
title: i18n.str`The operation was not found.`,
description: hasError.detail.hint as TranslatedString,