summaryrefslogtreecommitdiff
path: root/packages/merchant-backoffice-ui/src/hooks/index.ts
diff options
context:
space:
mode:
Diffstat (limited to 'packages/merchant-backoffice-ui/src/hooks/index.ts')
-rw-r--r--packages/merchant-backoffice-ui/src/hooks/index.ts15
1 files changed, 7 insertions, 8 deletions
diff --git a/packages/merchant-backoffice-ui/src/hooks/index.ts b/packages/merchant-backoffice-ui/src/hooks/index.ts
index 9c194fdee..cb58cf066 100644
--- a/packages/merchant-backoffice-ui/src/hooks/index.ts
+++ b/packages/merchant-backoffice-ui/src/hooks/index.ts
@@ -1,6 +1,6 @@
/*
This file is part of GNU Taler
- (C) 2021-2023 Taler Systems S.A.
+ (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
@@ -21,10 +21,9 @@
import { buildCodecForObject, codecForMap, codecForString, codecForTimestamp } from "@gnu-taler/taler-util";
import { buildStorageKey, useLocalStorage } from "@gnu-taler/web-util/browser";
-import { StateUpdater, useEffect, useState } from "preact/hooks";
+import { StateUpdater, useState } from "preact/hooks";
import { LoginToken } from "../declaration.js";
import { ValueOrFunction } from "../utils/types.js";
-import { useMatchMutate } from "./backend.js";
const calculateRootPath = () => {
const rootPath =
@@ -48,7 +47,7 @@ const loginTokenCodec = buildCodecForObject<LoginToken>()
const TOKENS_KEY = buildStorageKey("merchant-token", codecForMap(loginTokenCodec));
-export function useBackendURL(
+function useBackendURL(
url?: string,
): [string, StateUpdater<string>] {
const [value, setter] = useSimpleLocalStorage(
@@ -63,7 +62,7 @@ export function useBackendURL(
return [value!, checkedSetter];
}
-export function useBackendDefaultToken(
+function useBackendDefaultToken(
): [LoginToken | undefined, ((d: LoginToken | undefined) => void)] {
const { update: setToken, value: tokenMap, reset } = useLocalStorage(TOKENS_KEY, {})
@@ -86,7 +85,7 @@ export function useBackendDefaultToken(
return [tokenMap["default"], updateToken];
}
-export function useBackendInstanceToken(
+function useBackendInstanceToken(
id: string,
): [LoginToken | undefined, ((d: LoginToken | undefined) => void)] {
const { update: setToken, value: tokenMap, reset } = useLocalStorage(TOKENS_KEY, {})
@@ -110,7 +109,7 @@ export function useBackendInstanceToken(
return [tokenMap[id], updateToken];
}
-export function useLang(initial?: string): [string, StateUpdater<string>] {
+function useLang(initial?: string): [string, StateUpdater<string>] {
const browserLang =
typeof window !== "undefined"
? navigator.language || (navigator as any).userLanguage
@@ -119,7 +118,7 @@ export function useLang(initial?: string): [string, StateUpdater<string>] {
return useSimpleLocalStorage("lang-preference", defaultLang) as [string, StateUpdater<string>];
}
-export function useSimpleLocalStorage(
+function useSimpleLocalStorage(
key: string,
initialValue?: string,
): [string | undefined, StateUpdater<string | undefined>] {