From f2b319921c53010446e05ac4f24eef9995f65836 Mon Sep 17 00:00:00 2001 From: Sebastian Date: Fri, 9 Dec 2022 11:58:39 -0300 Subject: use translation from commons --- packages/demobank-ui/src/hooks/backend.ts | 4 ++-- packages/demobank-ui/src/hooks/index.ts | 10 +++++----- 2 files changed, 7 insertions(+), 7 deletions(-) (limited to 'packages/demobank-ui/src/hooks') 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 */ -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 | ((p: T) => T); const calculateRootPath = () => { @@ -34,11 +34,11 @@ const calculateRootPath = () => { export function useBackendURL( url?: string, ): [string, boolean, StateUpdater, () => 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) => { setTriedToLog("yes"); @@ -55,13 +55,13 @@ export function useBackendDefaultToken(): [ string | undefined, StateUpdater, ] { - return hooks.useLocalStorage("backend-token"); + return useLocalStorage("backend-token"); } export function useBackendInstanceToken( id: string, ): [string | undefined, StateUpdater] { - 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 -- cgit v1.2.3