From 8c20f4b27946679267bb44255721a9f14ae1077a Mon Sep 17 00:00:00 2001 From: Sebastian Date: Mon, 11 Sep 2023 15:07:55 -0300 Subject: new login token --- .../merchant-backoffice-ui/src/Application.tsx | 32 ++++++++++------------ 1 file changed, 14 insertions(+), 18 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 5e82821ae..1a7617643 100644 --- a/packages/merchant-backoffice-ui/src/Application.tsx +++ b/packages/merchant-backoffice-ui/src/Application.tsx @@ -41,7 +41,8 @@ import { 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 { ConnectionPage, LoginPage } from "./paths/login/index.js"; +import { LoginToken } from "./declaration.js"; export function Application(): VNode { return ( @@ -59,25 +60,20 @@ export function Application(): VNode { * @returns */ function ApplicationStatusRoutes(): VNode { - const { url, updateLoginStatus, triedToLog } = useBackendContext(); + const { url: backendURL, updateToken, changeBackend } = useBackendContext(); const result = useBackendConfig(); const { i18n } = useTranslationContext(); - const updateLoginInfoAndGoToRoot = (url: string, token?: string) => { - updateLoginStatus(url, token); - route("/"); - }; - const { currency, version } = result.ok ? result.data : { currency: "unknown", version: "unknown" }; const ctx = useMemo(() => ({ currency, version }), [currency, version]); - if (!triedToLog) { + if (!backendURL) { return ( - + ); } @@ -91,7 +87,7 @@ function ApplicationStatusRoutes(): VNode { return ( - + ); } @@ -109,7 +105,7 @@ function ApplicationStatusRoutes(): VNode { description: `Check your url`, }} /> - + ); } @@ -120,10 +116,10 @@ function ApplicationStatusRoutes(): VNode { notification={{ message: i18n.str`Server response with an error code`, type: "ERROR", - description: i18n.str`Got message ${result.message} from ${result.info?.url}`, + description: i18n.str`Got message "${result.message}" from ${result.info?.url}`, }} /> - + ; } if (result.type === ErrorType.UNREADABLE) { @@ -133,10 +129,10 @@ function ApplicationStatusRoutes(): VNode { notification={{ message: i18n.str`Response from server is unreadable, http status: ${result.status}`, type: "ERROR", - description: i18n.str`Got message ${result.message} from ${result.info?.url}`, + description: i18n.str`Got message "${result.message}" from ${result.info?.url}`, }} /> - + ; } return ( @@ -146,10 +142,10 @@ function ApplicationStatusRoutes(): VNode { notification={{ message: i18n.str`Unexpected Error`, type: "ERROR", - description: i18n.str`Got message ${result.message} from ${result.info?.url}`, + description: i18n.str`Got message "${result.message}" from ${result.info?.url}`, }} /> - + ); } @@ -168,7 +164,7 @@ function ApplicationStatusRoutes(): VNode { description: i18n.str`Merchant backend server version ${result.data.version} is not compatible with the supported version ${SUPPORTED_VERSION}`, }} /> - + } -- cgit v1.2.3