diff options
Diffstat (limited to 'packages/merchant-backoffice-ui/src/paths/instance/webhooks/update/index.tsx')
-rw-r--r-- | packages/merchant-backoffice-ui/src/paths/instance/webhooks/update/index.tsx | 18 |
1 files changed, 15 insertions, 3 deletions
diff --git a/packages/merchant-backoffice-ui/src/paths/instance/webhooks/update/index.tsx b/packages/merchant-backoffice-ui/src/paths/instance/webhooks/update/index.tsx index b9a8674b3..39f3d24cb 100644 --- a/packages/merchant-backoffice-ui/src/paths/instance/webhooks/update/index.tsx +++ b/packages/merchant-backoffice-ui/src/paths/instance/webhooks/update/index.tsx @@ -20,6 +20,7 @@ */ import { + ErrorType, HttpError, useTranslationContext, } from "@gnu-taler/web-util/lib/index.browser"; @@ -34,6 +35,7 @@ import { } from "../../../../hooks/webhooks.js"; import { Notification } from "../../../../utils/types.js"; import { UpdatePage } from "./UpdatePage.js"; +import { HttpStatusCode } from "@gnu-taler/taler-util"; export type Entity = MerchantBackend.Webhooks.WebhookPatchDetails & WithId; @@ -59,10 +61,20 @@ export default function UpdateWebhook({ const { i18n } = useTranslationContext(); - if (result.clientError && result.isUnauthorized) return onUnauthorized(); - if (result.clientError && result.isNotfound) return onNotFound(); if (result.loading) return <Loading />; - if (!result.ok) return onLoadError(result); + if (!result.ok) { + if ( + result.type === ErrorType.CLIENT && + result.status === HttpStatusCode.Unauthorized + ) + return onUnauthorized(); + if ( + result.type === ErrorType.CLIENT && + result.status === HttpStatusCode.NotFound + ) + return onNotFound(); + return onLoadError(result); + } return ( <Fragment> |