diff options
Diffstat (limited to 'packages/merchant-backoffice-ui/src/paths/login/index.tsx')
-rw-r--r-- | packages/merchant-backoffice-ui/src/paths/login/index.tsx | 10 |
1 files changed, 5 insertions, 5 deletions
diff --git a/packages/merchant-backoffice-ui/src/paths/login/index.tsx b/packages/merchant-backoffice-ui/src/paths/login/index.tsx index d155dd255..d94b7e506 100644 --- a/packages/merchant-backoffice-ui/src/paths/login/index.tsx +++ b/packages/merchant-backoffice-ui/src/paths/login/index.tsx @@ -19,6 +19,7 @@ * @author Sebastian Javier Marchano (sebasjm) */ +import { HttpStatusCode } from "@gnu-taler/taler-util"; import { useMerchantApiContext, useTranslationContext, @@ -27,9 +28,8 @@ import { ComponentChildren, Fragment, VNode, h } from "preact"; import { useState } from "preact/hooks"; import { NotificationCard } from "../../components/menu/index.js"; import { AccessToken } from "../../declaration.js"; -import { useSessionState } from "../../hooks/session.js"; +import { DEFAULT_ADMIN_USERNAME, useSessionState } from "../../hooks/session.js"; import { Notification } from "../../utils/types.js"; -import { HttpStatusCode } from "@gnu-taler/taler-util"; interface Props { } @@ -41,7 +41,7 @@ function normalizeToken(r: string): AccessToken { export function LoginPage(_p: Props): VNode { const [token, setToken] = useState(""); const [notif, setNotif] = useState<Notification | undefined>(undefined); - const { logIn } = useSessionState(); + const { state, logIn } = useSessionState(); const { lib } = useMerchantApiContext(); const { i18n } = useTranslationContext(); @@ -57,7 +57,7 @@ export function LoginPage(_p: Props): VNode { }); if (result.type === "ok") { const { access_token } = result.body; - logIn({ token: access_token }); + logIn({ instance: state.instance, token: access_token }); return; } else { switch(result.case) { @@ -79,7 +79,7 @@ export function LoginPage(_p: Props): VNode { } } - if (admin && id !== "default") { + if (state.isAdmin && state.instance !== DEFAULT_ADMIN_USERNAME) { //admin trying to access another instance return ( <div class="columns is-centered" style={{ margin: "auto" }}> |