diff options
Diffstat (limited to 'packages/merchant-backoffice-ui/src/paths')
| -rw-r--r-- | packages/merchant-backoffice-ui/src/paths/login/index.tsx | 104 | 
1 files changed, 4 insertions, 100 deletions
diff --git a/packages/merchant-backoffice-ui/src/paths/login/index.tsx b/packages/merchant-backoffice-ui/src/paths/login/index.tsx index e37ef4bef..1c98b7c9b 100644 --- a/packages/merchant-backoffice-ui/src/paths/login/index.tsx +++ b/packages/merchant-backoffice-ui/src/paths/login/index.tsx @@ -36,7 +36,7 @@ function normalizeToken(r: string): AccessToken {  }  export function LoginPage({ onConfirm }: Props): VNode { -  const { url: backendURL, changeBackend, resetBackend } = useBackendContext(); +  const { url: backendURL } = useBackendContext();    const { admin, id } = useInstanceContext();    const { requestNewLoginToken } = useCredentialsChecker();    const [token, setToken] = useState(""); @@ -54,11 +54,7 @@ export function LoginPage({ onConfirm }: Props): VNode {      } else {        onConfirm(undefined);      } -  }, [backendURL, id, token]) - -  async function changeServer() { -    resetBackend() -  } +  }, [id, token])    if (admin && id !== "default") {      //admin trying to access another instance @@ -139,26 +135,7 @@ export function LoginPage({ onConfirm }: Props): VNode {              style={{ border: "1px solid", borderTop: 0, borderBottom: 0 }}            >              <i18n.Translate>Please enter your access token.</i18n.Translate> -            <div class="field is-horizontal"> -              <div class="field-label is-normal"> -                <label class="label">URL</label> -              </div> -              <div class="field-body"> -                <div class="field"> -                  <p class="control is-expanded"> -                    <input -                      class="input" -                      type="text" -                      placeholder="set new url" -                      name="id" -                      value={backendURL} -                      disabled -                      readOnly -                    /> -                  </p> -                </div> -              </div> -            </div> +              <div class="field is-horizontal">                <div class="field-label is-normal">                  <label class="label"> @@ -194,10 +171,7 @@ export function LoginPage({ onConfirm }: Props): VNode {                borderTop: 0,              }}            > -            <AsyncButton onClick={changeServer}> -              <i18n.Translate>Change server</i18n.Translate> -            </AsyncButton> - +            <div />              <AsyncButton                type="is-info"                onClick={doLogin} @@ -226,73 +200,3 @@ function AsyncButton({ onClick, disabled, type = "", children }: { type?: string  } -export function ConnectionPage({ onConfirm }: { onConfirm: (s: string) => void }): VNode { -  const { url: backendURL } = useBackendContext() - -  const [error, setError] = useState<string>(); -  const [url, setURL] = useState(backendURL ?? ""); -  const { i18n } = useTranslationContext(); - -  async function doConnect() { -    const withHttp = url.startsWith("http") ? url : "https://" + url -     -    onConfirm(withHttp) -  } - -  return ( -    <div class="columns is-centered" style={{ margin: "auto" }}> -      <div class="column is-two-thirds "> -        <div class="modal-card" style={{ width: "100%", margin: 0 }}> -          <header -            class="modal-card-head" -            style={{ border: "1px solid", borderBottom: 0 }} -          > -            <p class="modal-card-title">{i18n.str`Connect to backend`}</p> -          </header> -          <section -            class="modal-card-body" -            style={{ border: "1px solid", borderTop: 0, borderBottom: 0 }} -          > -            <i18n.Translate>Location of the backend server</i18n.Translate> -            <div class="field is-horizontal"> -              <div class="field-label is-normal"> -                <label class="label">URL</label> -              </div> -              <div class="field-body"> -                <div class="field"> -                  <p class="control is-expanded"> -                    <input -                      class="input" -                      type="text" -                      placeholder="set new url" -                      name="id" -                      value={url ?? ""} -                      onKeyPress={(e) => -                        e.keyCode === 13 -                          ? doConnect() -                          : null -                      } -                      onInput={(e): void => setURL(e?.currentTarget.value)} -                    /> -                  </p> -                </div> -              </div> -            </div> -          </section> -          <footer -            class="modal-card-foot " -            style={{ -              justifyContent: "flex-end", -              border: "1px solid", -              borderTop: 0, -            }} -          > -            <AsyncButton onClick={doConnect}> -              <i18n.Translate>Connect</i18n.Translate> -            </AsyncButton> -          </footer> -        </div> -      </div> -    </div> -  ); -}
\ No newline at end of file  | 
