aboutsummaryrefslogtreecommitdiff
path: root/packages/merchant-backoffice-ui/src/context
diff options
context:
space:
mode:
Diffstat (limited to 'packages/merchant-backoffice-ui/src/context')
-rw-r--r--packages/merchant-backoffice-ui/src/context/instance.ts35
-rw-r--r--packages/merchant-backoffice-ui/src/context/session.ts7
2 files changed, 5 insertions, 37 deletions
diff --git a/packages/merchant-backoffice-ui/src/context/instance.ts b/packages/merchant-backoffice-ui/src/context/instance.ts
deleted file mode 100644
index 9b67f7170..000000000
--- a/packages/merchant-backoffice-ui/src/context/instance.ts
+++ /dev/null
@@ -1,35 +0,0 @@
-/*
- This file is part of GNU Taler
- (C) 2021-2024 Taler Systems S.A.
-
- GNU Taler is free software; you can redistribute it and/or modify it under the
- terms of the GNU General Public License as published by the Free Software
- Foundation; either version 3, or (at your option) any later version.
-
- GNU Taler is distributed in the hope that it will be useful, but WITHOUT ANY
- WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR
- A PARTICULAR PURPOSE. See the GNU General Public License for more details.
-
- You should have received a copy of the GNU General Public License along with
- GNU Taler; see the file COPYING. If not, see <http://www.gnu.org/licenses/>
- */
-
-/**
- *
- * @author Sebastian Javier Marchano (sebasjm)
- */
-
-import { createContext } from "preact";
-import { useContext } from "preact/hooks";
-
-interface Type {
- id: string;
- token?: LoginToken;
- admin?: boolean;
- changeToken: (t?: LoginToken) => void;
-}
-
-const Context = createContext<Type>({} as any);
-
-const InstanceContextProvider = Context.Provider;
-const useInstanceContext = (): Type => useContext(Context);
diff --git a/packages/merchant-backoffice-ui/src/context/session.ts b/packages/merchant-backoffice-ui/src/context/session.ts
index 83f3f113a..9d63d8e33 100644
--- a/packages/merchant-backoffice-ui/src/context/session.ts
+++ b/packages/merchant-backoffice-ui/src/context/session.ts
@@ -215,7 +215,8 @@ export function useSessionContext(): SessionStateHandler {
.href,
isAdmin: info.instance === DEFAULT_ADMIN_USERNAME,
instance: info.instance,
- token: info.token,
+ // FIXME: bank and merchant should have consistent behavior
+ token: info.token?.substring("secret-token:".length) as AccessToken,
impersonate: {
originalBackendUrl: state.backendUrl,
originalToken: state.token,
@@ -239,7 +240,9 @@ export function useSessionContext(): SessionStateHandler {
impersonate: undefined,
...state,
status: "loggedIn",
- token: info.token,
+ // FIXME: bank and merchant should have consistent behavior
+ token: info.token?.substring("secret-token:".length) as AccessToken,
+ // token: info.token,
};
update(nextState);
cleanAllCache();