From 4e11051d9fccdbdd40abaa630afc130eafef6602 Mon Sep 17 00:00:00 2001
From: Sebastian <sebasjm@gmail.com>
Date: Tue, 10 Oct 2023 07:12:20 -0300
Subject: removing url from login

---
 .../src/ApplicationReadyRoutes.tsx                      | 17 ++++++++++++++---
 1 file changed, 14 insertions(+), 3 deletions(-)

(limited to 'packages/merchant-backoffice-ui/src/ApplicationReadyRoutes.tsx')

diff --git a/packages/merchant-backoffice-ui/src/ApplicationReadyRoutes.tsx b/packages/merchant-backoffice-ui/src/ApplicationReadyRoutes.tsx
index ebfa2b6d6..55accd989 100644
--- a/packages/merchant-backoffice-ui/src/ApplicationReadyRoutes.tsx
+++ b/packages/merchant-backoffice-ui/src/ApplicationReadyRoutes.tsx
@@ -26,13 +26,14 @@ import { Route, Router, route } from "preact-router";
 import { useState } from "preact/hooks";
 import { InstanceRoutes } from "./InstanceRoutes.js";
 import {
+  NotConnectedAppMenu,
   NotYetReadyAppMenu,
   NotificationCard,
 } from "./components/menu/index.js";
 import { useBackendContext } from "./context/backend.js";
 import { LoginToken } from "./declaration.js";
 import { useBackendInstancesTestForAdmin } from "./hooks/backend.js";
-import { ConnectionPage, LoginPage } from "./paths/login/index.js";
+import { LoginPage } from "./paths/login/index.js";
 import { Settings } from "./paths/settings/index.js";
 import { INSTANCE_ID_LOOKUP } from "./utils/constants.js";
 
@@ -42,10 +43,11 @@ import { INSTANCE_ID_LOOKUP } from "./utils/constants.js";
  */
 export function ApplicationReadyRoutes(): VNode {
   const { i18n } = useTranslationContext();
-  const { url: backendURL, changeBackend } = useBackendContext()
   const [unauthorized, setUnauthorized] = useState(false)
   const {
+    url: backendURL,
     updateToken,
+    alreadyTriedLogin,
   } = useBackendContext();
 
   function updateLoginStatus(token: LoginToken | undefined) {
@@ -64,6 +66,15 @@ export function ApplicationReadyRoutes(): VNode {
     && result.type === ErrorType.CLIENT
     && result.status === HttpStatusCode.Unauthorized;
 
+  if (!alreadyTriedLogin) {
+    return (
+      <Fragment>
+        <NotConnectedAppMenu title="Welcome!" />
+        <LoginPage onConfirm={updateToken} />
+      </Fragment>
+    );
+  }
+
   if (showSettings) {
     return <Fragment>
       <NotYetReadyAppMenu onShowSettings={() => setShowSettings(true)} title="UI Settings" onLogout={clearTokenAndGoToRoot} isPasswordOk={false} />
@@ -100,7 +111,7 @@ export function ApplicationReadyRoutes(): VNode {
               type: "ERROR",
             }}
           />
-          <ConnectionPage onConfirm={changeBackend} />
+          {/* <ConnectionPage onConfirm={changeBackend} /> */}
         </Fragment>
       );
     }
-- 
cgit v1.2.3

