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/orders/list/index.tsx | |
parent | 958747bd08172ce00bc84ea3c543eac414a1d39b (diff) | |
download | wallet-core-cfe7129c4ecaa3057d5e47040f0a9efd8ed0317e.tar.xz |
adding unreadable http response case and removing deprecated fields
Diffstat (limited to 'packages/merchant-backoffice-ui/src/paths/instance/orders/list/index.tsx')
-rw-r--r-- | packages/merchant-backoffice-ui/src/paths/instance/orders/list/index.tsx | 34 |
1 files changed, 28 insertions, 6 deletions
diff --git a/packages/merchant-backoffice-ui/src/paths/instance/orders/list/index.tsx b/packages/merchant-backoffice-ui/src/paths/instance/orders/list/index.tsx index bd0924808..9a367291f 100644 --- a/packages/merchant-backoffice-ui/src/paths/instance/orders/list/index.tsx +++ b/packages/merchant-backoffice-ui/src/paths/instance/orders/list/index.tsx @@ -20,6 +20,7 @@ */ import { + ErrorType, HttpError, useTranslationContext, } from "@gnu-taler/web-util/lib/index.browser"; @@ -37,6 +38,7 @@ import { import { Notification } from "../../../../utils/types.js"; import { ListPage } from "./ListPage.js"; import { RefundModal } from "./Table.js"; +import { HttpStatusCode } from "@gnu-taler/taler-util"; interface Props { onUnauthorized: () => VNode; @@ -71,10 +73,20 @@ export default function OrderList({ undefined, ); - 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); + } const isPaidActive = filter.paid === "yes" ? "is-active" : ""; const isRefundedActive = filter.refunded === "yes" ? "is-active" : ""; @@ -195,10 +207,20 @@ function RefundModalForTable({ }: RefundProps): VNode { const result = useOrderDetails(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 ( <RefundModal |