From cfe7129c4ecaa3057d5e47040f0a9efd8ed0317e Mon Sep 17 00:00:00 2001
From: Sebastian <sebasjm@gmail.com>
Date: Fri, 7 Apr 2023 18:46:25 -0300
Subject: adding unreadable http response case and removing deprecated fields

---
 .../src/paths/instance/products/list/index.tsx         | 18 +++++++++++++++---
 1 file changed, 15 insertions(+), 3 deletions(-)

(limited to 'packages/merchant-backoffice-ui/src/paths/instance/products/list/index.tsx')

diff --git a/packages/merchant-backoffice-ui/src/paths/instance/products/list/index.tsx b/packages/merchant-backoffice-ui/src/paths/instance/products/list/index.tsx
index c32339563..216ab59e7 100644
--- a/packages/merchant-backoffice-ui/src/paths/instance/products/list/index.tsx
+++ b/packages/merchant-backoffice-ui/src/paths/instance/products/list/index.tsx
@@ -20,6 +20,7 @@
  */
 
 import {
+  ErrorType,
   HttpError,
   useTranslationContext,
 } from "@gnu-taler/web-util/lib/index.browser";
@@ -34,6 +35,7 @@ import {
 } from "../../../../hooks/product.js";
 import { Notification } from "../../../../utils/types.js";
 import { CardTable } from "./Table.js";
+import { HttpStatusCode } from "@gnu-taler/taler-util";
 
 interface Props {
   onUnauthorized: () => VNode;
@@ -55,10 +57,20 @@ export default function ProductList({
 
   const { i18n } = useTranslationContext();
 
-  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 (
     <section class="section is-main-section">
-- 
cgit v1.2.3

