From cfe7129c4ecaa3057d5e47040f0a9efd8ed0317e Mon Sep 17 00:00:00 2001 From: Sebastian Date: Fri, 7 Apr 2023 18:46:25 -0300 Subject: adding unreadable http response case and removing deprecated fields --- .../src/paths/instance/update/index.tsx | 18 +++++++++++++++--- 1 file changed, 15 insertions(+), 3 deletions(-) (limited to 'packages/merchant-backoffice-ui/src/paths/instance/update') diff --git a/packages/merchant-backoffice-ui/src/paths/instance/update/index.tsx b/packages/merchant-backoffice-ui/src/paths/instance/update/index.tsx index 912393c7c..6904c2efd 100644 --- a/packages/merchant-backoffice-ui/src/paths/instance/update/index.tsx +++ b/packages/merchant-backoffice-ui/src/paths/instance/update/index.tsx @@ -14,6 +14,7 @@ GNU Taler; see the file COPYING. If not, see */ import { + ErrorType, HttpError, HttpResponse, useTranslationContext, @@ -32,6 +33,7 @@ import { } from "../../../hooks/instance.js"; import { Notification } from "../../../utils/types.js"; import { UpdatePage } from "./UpdatePage.js"; +import { HttpStatusCode } from "@gnu-taler/taler-util"; export interface Props { onBack: () => void; @@ -78,10 +80,20 @@ function CommonUpdate( const [notif, setNotif] = useState(undefined); const { i18n } = useTranslationContext(); - if (result.clientError && result.isUnauthorized) return onUnauthorized(); - if (result.clientError && result.isNotfound) return onNotFound(); if (result.loading) return ; - 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 ( -- cgit v1.2.3