aboutsummaryrefslogtreecommitdiff
path: root/packages/merchant-backoffice-ui/src/paths/instance/orders/list/index.tsx
diff options
context:
space:
mode:
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.tsx34
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