diff options
author | Sebastian <sebasjm@gmail.com> | 2023-04-07 18:46:25 -0300 |
---|---|---|
committer | Sebastian <sebasjm@gmail.com> | 2023-04-07 18:46:25 -0300 |
commit | cfe7129c4ecaa3057d5e47040f0a9efd8ed0317e (patch) | |
tree | c4a282300fec9be588bdb90bc7b94ab9e21ddfd0 /packages/merchant-backoffice-ui/src/paths/instance/transfers/list/index.tsx | |
parent | 958747bd08172ce00bc84ea3c543eac414a1d39b (diff) | |
download | wallet-core-cfe7129c4ecaa3057d5e47040f0a9efd8ed0317e.tar.gz wallet-core-cfe7129c4ecaa3057d5e47040f0a9efd8ed0317e.tar.bz2 wallet-core-cfe7129c4ecaa3057d5e47040f0a9efd8ed0317e.zip |
adding unreadable http response case and removing deprecated fields
Diffstat (limited to 'packages/merchant-backoffice-ui/src/paths/instance/transfers/list/index.tsx')
-rw-r--r-- | packages/merchant-backoffice-ui/src/paths/instance/transfers/list/index.tsx | 19 |
1 files changed, 15 insertions, 4 deletions
diff --git a/packages/merchant-backoffice-ui/src/paths/instance/transfers/list/index.tsx b/packages/merchant-backoffice-ui/src/paths/instance/transfers/list/index.tsx index 8ca469c61..8e8d7f2ed 100644 --- a/packages/merchant-backoffice-ui/src/paths/instance/transfers/list/index.tsx +++ b/packages/merchant-backoffice-ui/src/paths/instance/transfers/list/index.tsx @@ -19,7 +19,7 @@ * @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 { h, VNode } from "preact"; import { useState } from "preact/hooks"; import { Loading } from "../../../../components/exception/loading.js"; @@ -27,6 +27,7 @@ import { MerchantBackend } from "../../../../declaration.js"; import { useInstanceDetails } from "../../../../hooks/instance.js"; import { useInstanceTransfers } from "../../../../hooks/transfer.js"; import { ListPage } from "./ListPage.js"; +import { HttpStatusCode } from "@gnu-taler/taler-util"; interface Props { onUnauthorized: () => VNode; @@ -68,10 +69,20 @@ export default function ListTransfer({ (id) => setPosition(id), ); - 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 ( <ListPage |