From cfe7129c4ecaa3057d5e47040f0a9efd8ed0317e Mon Sep 17 00:00:00 2001 From: Sebastian Date: Fri, 7 Apr 2023 18:46:25 -0300 Subject: adding unreadable http response case and removing deprecated fields --- .../merchant-backoffice-ui/src/Application.tsx | 67 ++++++++++++++-------- 1 file changed, 43 insertions(+), 24 deletions(-) (limited to 'packages/merchant-backoffice-ui/src/Application.tsx') diff --git a/packages/merchant-backoffice-ui/src/Application.tsx b/packages/merchant-backoffice-ui/src/Application.tsx index ed1fc69f3..354212946 100644 --- a/packages/merchant-backoffice-ui/src/Application.tsx +++ b/packages/merchant-backoffice-ui/src/Application.tsx @@ -20,6 +20,7 @@ */ import { + ErrorType, TranslationProvider, useTranslationContext, } from "@gnu-taler/web-util/lib/index.browser"; @@ -40,6 +41,7 @@ import { ConfigContextProvider } from "./context/config.js"; import { useBackendConfig } from "./hooks/backend.js"; import { strings } from "./i18n/strings.js"; import LoginPage from "./paths/login/index.js"; +import { HttpStatusCode } from "@gnu-taler/taler-util"; export function Application(): VNode { return ( @@ -77,47 +79,63 @@ function ApplicationStatusRoutes(): VNode { ); } - if (result.clientError && result.isUnauthorized) - return ( - - - - - ); - - if (result.clientError && result.isNotfound) - return ( + if (!result.ok) { + if (result.loading) return ; + if ( + result.type === ErrorType.CLIENT && + result.status === HttpStatusCode.Unauthorized + ) { + return ( + + + + + ); + } + if ( + result.type === ErrorType.CLIENT && + result.status === HttpStatusCode.NotFound + ) { + return ( + + + + + + ); + } + if (result.type === ErrorType.SERVER) { - - ); - - if (result.serverError) - return ( + ; + } + if (result.type === ErrorType.UNREADABLE) { - - ); - - if (result.loading) return ; - - if (!result.ok) + ; + } return ( @@ -131,6 +149,7 @@ function ApplicationStatusRoutes(): VNode { ); + } return (
-- cgit v1.2.3