diff options
Diffstat (limited to 'packages/merchant-backoffice-ui/src/paths/instance/reserves/details/index.tsx')
-rw-r--r-- | packages/merchant-backoffice-ui/src/paths/instance/reserves/details/index.tsx | 19 |
1 files changed, 15 insertions, 4 deletions
diff --git a/packages/merchant-backoffice-ui/src/paths/instance/reserves/details/index.tsx b/packages/merchant-backoffice-ui/src/paths/instance/reserves/details/index.tsx index 4a235bcea..e7919aab1 100644 --- a/packages/merchant-backoffice-ui/src/paths/instance/reserves/details/index.tsx +++ b/packages/merchant-backoffice-ui/src/paths/instance/reserves/details/index.tsx @@ -19,12 +19,13 @@ * @author Sebastian Javier Marchano (sebasjm) */ -import { HttpError } from "@gnu-taler/web-util/lib/index.browser"; +import { ErrorType, HttpError } from "@gnu-taler/web-util/lib/index.browser"; import { Fragment, h, VNode } from "preact"; import { Loading } from "../../../../components/exception/loading.js"; import { MerchantBackend } from "../../../../declaration.js"; import { useReserveDetails } from "../../../../hooks/reserves.js"; import { DetailPage } from "./DetailPage.js"; +import { HttpStatusCode } from "@gnu-taler/taler-util"; interface Props { rid: string; @@ -45,10 +46,20 @@ export default function DetailReserve({ }: Props): VNode { const result = useReserveDetails(rid); - 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> <DetailPage selected={result.data} onBack={onBack} id={rid} /> |