aboutsummaryrefslogtreecommitdiff
path: root/packages/merchant-backoffice-ui/src/paths/instance/details/index.tsx
diff options
context:
space:
mode:
authorSebastian <sebasjm@gmail.com>2023-04-07 18:46:25 -0300
committerSebastian <sebasjm@gmail.com>2023-04-07 18:46:25 -0300
commitcfe7129c4ecaa3057d5e47040f0a9efd8ed0317e (patch)
treec4a282300fec9be588bdb90bc7b94ab9e21ddfd0 /packages/merchant-backoffice-ui/src/paths/instance/details/index.tsx
parent958747bd08172ce00bc84ea3c543eac414a1d39b (diff)
downloadwallet-core-cfe7129c4ecaa3057d5e47040f0a9efd8ed0317e.tar.xz
adding unreadable http response case and removing deprecated fields
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.tsx19
1 files changed, 15 insertions, 4 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 25d37a5cb..17089c555 100644
--- a/packages/merchant-backoffice-ui/src/paths/instance/details/index.tsx
+++ b/packages/merchant-backoffice-ui/src/paths/instance/details/index.tsx
@@ -13,7 +13,7 @@
You should have received a copy of the GNU General Public License along with
GNU Taler; see the file COPYING. If not, see <http://www.gnu.org/licenses/>
*/
-import { HttpError } from "@gnu-taler/web-util/lib/index.browser";
+import { ErrorType, HttpError } from "@gnu-taler/web-util/lib/index.browser";
import { Fragment, h, VNode } from "preact";
import { useState } from "preact/hooks";
import { Loading } from "../../../components/exception/loading.js";
@@ -22,6 +22,7 @@ import { useInstanceContext } from "../../../context/instance.js";
import { MerchantBackend } from "../../../declaration.js";
import { useInstanceAPI, useInstanceDetails } from "../../../hooks/instance.js";
import { DetailPage } from "./DetailPage.js";
+import { HttpStatusCode } from "@gnu-taler/taler-util";
interface Props {
onUnauthorized: () => VNode;
@@ -44,10 +45,20 @@ export default function Detail({
const { deleteInstance } = useInstanceAPI();
- 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 (
<Fragment>