diff options
Diffstat (limited to 'packages/merchant-backoffice-ui/src/paths/instance/details/index.tsx')
-rw-r--r-- | packages/merchant-backoffice-ui/src/paths/instance/details/index.tsx | 38 |
1 files changed, 22 insertions, 16 deletions
diff --git a/packages/merchant-backoffice-ui/src/paths/instance/details/index.tsx b/packages/merchant-backoffice-ui/src/paths/instance/details/index.tsx index 2714c8e02..627b5d1be 100644 --- a/packages/merchant-backoffice-ui/src/paths/instance/details/index.tsx +++ b/packages/merchant-backoffice-ui/src/paths/instance/details/index.tsx @@ -20,8 +20,9 @@ import { Loading } from "../../../components/exception/loading.js"; import { DeleteModal } from "../../../components/modal/index.js"; import { useInstanceDetails } from "../../../hooks/instance.js"; import { DetailPage } from "./DetailPage.js"; -import { HttpStatusCode, TalerErrorDetail } from "@gnu-taler/taler-util"; +import { HttpStatusCode, TalerError, TalerErrorDetail } from "@gnu-taler/taler-util"; import { useSessionContext } from "../../../context/session.js"; +import { ErrorLoadingMerchant } from "../../../components/ErrorLoadingMerchant.js"; interface Props { onUnauthorized: () => VNode; @@ -45,31 +46,36 @@ export default function Detail({ // const { deleteInstance } = useInstanceAPI(); const { lib } = useMerchantApiContext(); - if (result.loading) return <Loading />; - 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); + if (!result) return <Loading /> + if (result instanceof TalerError) { + return <ErrorLoadingMerchant error={result} /> } + // if (result.loading) return <Loading />; + // 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} + selected={result.body} onUpdate={onUpdate} onDelete={() => setDeleting(true)} /> {deleting && ( <DeleteModal - element={{ name: result.data.name, id: state.instance }} + element={{ name: result.body.name, id: state.instance }} onCancel={() => setDeleting(false)} onConfirm={async (): Promise<void> => { if (state.status !== "loggedIn") { |