diff options
Diffstat (limited to 'packages/merchant-backoffice-ui/src/paths/instance/orders')
-rw-r--r-- | packages/merchant-backoffice-ui/src/paths/instance/orders/create/index.tsx | 38 |
1 files changed, 22 insertions, 16 deletions
diff --git a/packages/merchant-backoffice-ui/src/paths/instance/orders/create/index.tsx b/packages/merchant-backoffice-ui/src/paths/instance/orders/create/index.tsx index a7165fa41..54d8c7b47 100644 --- a/packages/merchant-backoffice-ui/src/paths/instance/orders/create/index.tsx +++ b/packages/merchant-backoffice-ui/src/paths/instance/orders/create/index.tsx @@ -19,7 +19,7 @@ * @author Sebastian Javier Marchano (sebasjm) */ -import { HttpStatusCode, TalerErrorDetail, TalerMerchantApi } from "@gnu-taler/taler-util"; +import { HttpStatusCode, TalerError, TalerErrorDetail, TalerMerchantApi } from "@gnu-taler/taler-util"; import { ErrorType, HttpError, useMerchantApiContext } from "@gnu-taler/web-util/browser"; import { Fragment, VNode, h } from "preact"; import { useState } from "preact/hooks"; @@ -30,6 +30,7 @@ import { useInstanceProducts } from "../../../../hooks/product.js"; import { Notification } from "../../../../utils/types.js"; import { CreatePage } from "./CreatePage.js"; import { useSessionContext } from "../../../../context/session.js"; +import { ErrorLoadingMerchant } from "../../../../components/ErrorLoadingMerchant.js"; export type Entity = { request: TalerMerchantApi.PostOrderRequest; @@ -55,22 +56,27 @@ export default function OrderCreate({ const detailsResult = useInstanceDetails(); const inventoryResult = useInstanceProducts(); - if (detailsResult.loading) return <Loading />; + if (!detailsResult) return <Loading /> + if (detailsResult instanceof TalerError) { + return <ErrorLoadingMerchant error={detailsResult} /> + } + + // if (detailsResult.loading) return <Loading />; if (inventoryResult.loading) return <Loading />; - if (!detailsResult.ok) { - if ( - detailsResult.type === ErrorType.CLIENT && - detailsResult.status === HttpStatusCode.Unauthorized - ) - return onUnauthorized(); - if ( - detailsResult.type === ErrorType.CLIENT && - detailsResult.status === HttpStatusCode.NotFound - ) - return onNotFound(); - return onLoadError(detailsResult); - } + // if (!detailsResult.ok) { + // if ( + // detailsResult.type === ErrorType.CLIENT && + // detailsResult.status === HttpStatusCode.Unauthorized + // ) + // return onUnauthorized(); + // if ( + // detailsResult.type === ErrorType.CLIENT && + // detailsResult.status === HttpStatusCode.NotFound + // ) + // return onNotFound(); + // return onLoadError(detailsResult); + // } if (!inventoryResult.ok) { if ( @@ -112,7 +118,7 @@ export default function OrderCreate({ }); }); }} - instanceConfig={detailsResult.data} + instanceConfig={detailsResult.body} instanceInventory={inventoryResult.data} /> </Fragment> |