diff options
Diffstat (limited to 'packages/merchant-backoffice-ui/src/paths/admin')
-rw-r--r-- | packages/merchant-backoffice-ui/src/paths/admin/list/index.tsx | 18 |
1 files changed, 15 insertions, 3 deletions
diff --git a/packages/merchant-backoffice-ui/src/paths/admin/list/index.tsx b/packages/merchant-backoffice-ui/src/paths/admin/list/index.tsx index dd1c1e557..12e5708cb 100644 --- a/packages/merchant-backoffice-ui/src/paths/admin/list/index.tsx +++ b/packages/merchant-backoffice-ui/src/paths/admin/list/index.tsx @@ -20,6 +20,7 @@ */ import { + ErrorType, HttpError, useTranslationContext, } from "@gnu-taler/web-util/lib/index.browser"; @@ -32,6 +33,7 @@ import { MerchantBackend } from "../../../declaration.js"; import { useAdminAPI, useBackendInstances } from "../../../hooks/instance.js"; import { Notification } from "../../../utils/types.js"; import { View } from "./View.js"; +import { HttpStatusCode } from "@gnu-taler/taler-util"; interface Props { onCreate: () => void; @@ -60,10 +62,20 @@ export default function Instances({ const [notif, setNotif] = useState<Notification | undefined>(undefined); 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> |