diff options
Diffstat (limited to 'packages/demobank-ui/src/hooks')
-rw-r--r-- | packages/demobank-ui/src/hooks/backend.ts | 4 | ||||
-rw-r--r-- | packages/demobank-ui/src/hooks/index.ts | 10 |
2 files changed, 7 insertions, 7 deletions
diff --git a/packages/demobank-ui/src/hooks/backend.ts b/packages/demobank-ui/src/hooks/backend.ts index f10696ac4..13a158f4f 100644 --- a/packages/demobank-ui/src/hooks/backend.ts +++ b/packages/demobank-ui/src/hooks/backend.ts @@ -14,7 +14,7 @@ GNU Taler; see the file COPYING. If not, see <http://www.gnu.org/licenses/> */ -import { hooks } from "@gnu-taler/web-util/lib/index.browser"; +import { useLocalStorage } from "@gnu-taler/web-util/lib/index.browser"; /** * Has the information to reach and @@ -48,7 +48,7 @@ export interface BackendStateHandler { * base URL. */ export function useBackendState(): BackendStateHandler { - const [value, update] = hooks.useLocalStorage( + const [value, update] = useLocalStorage( "backend-state", JSON.stringify(defaultState), ); diff --git a/packages/demobank-ui/src/hooks/index.ts b/packages/demobank-ui/src/hooks/index.ts index 007061f1a..c582a5c63 100644 --- a/packages/demobank-ui/src/hooks/index.ts +++ b/packages/demobank-ui/src/hooks/index.ts @@ -20,7 +20,7 @@ */ import { StateUpdater } from "preact/hooks"; -import { hooks } from "@gnu-taler/web-util/lib/index.browser"; +import { useLocalStorage, useNotNullLocalStorage } from "@gnu-taler/web-util/lib/index.browser"; export type ValueOrFunction<T> = T | ((p: T) => T); const calculateRootPath = () => { @@ -34,11 +34,11 @@ const calculateRootPath = () => { export function useBackendURL( url?: string, ): [string, boolean, StateUpdater<string>, () => void] { - const [value, setter] = hooks.useNotNullLocalStorage( + const [value, setter] = useNotNullLocalStorage( "backend-url", url || calculateRootPath(), ); - const [triedToLog, setTriedToLog] = hooks.useLocalStorage("tried-login"); + const [triedToLog, setTriedToLog] = useLocalStorage("tried-login"); const checkedSetter = (v: ValueOrFunction<string>) => { setTriedToLog("yes"); @@ -55,13 +55,13 @@ export function useBackendDefaultToken(): [ string | undefined, StateUpdater<string | undefined>, ] { - return hooks.useLocalStorage("backend-token"); + return useLocalStorage("backend-token"); } export function useBackendInstanceToken( id: string, ): [string | undefined, StateUpdater<string | undefined>] { - const [token, setToken] = hooks.useLocalStorage(`backend-token-${id}`); + const [token, setToken] = useLocalStorage(`backend-token-${id}`); const [defaultToken, defaultSetToken] = useBackendDefaultToken(); // instance named 'default' use the default token |