diff options
author | Sebastian <sebasjm@gmail.com> | 2023-02-08 17:41:19 -0300 |
---|---|---|
committer | Sebastian <sebasjm@gmail.com> | 2023-02-08 17:41:19 -0300 |
commit | a8c5a9696c1735a178158cbc9ac4f9bb4b6f013d (patch) | |
tree | fc24dbf06b548925dbc065a49060473fdd220c94 /packages/demobank-ui/src/context | |
parent | 9b0d887a1bc292f652352c1dba4ed4243a88bbbe (diff) | |
download | wallet-core-a8c5a9696c1735a178158cbc9ac4f9bb4b6f013d.tar.xz |
impl accout management and refactor
Diffstat (limited to 'packages/demobank-ui/src/context')
-rw-r--r-- | packages/demobank-ui/src/context/backend.ts | 4 | ||||
-rw-r--r-- | packages/demobank-ui/src/context/pageState.ts | 21 |
2 files changed, 12 insertions, 13 deletions
diff --git a/packages/demobank-ui/src/context/backend.ts b/packages/demobank-ui/src/context/backend.ts index 58907e565..b462d20e3 100644 --- a/packages/demobank-ui/src/context/backend.ts +++ b/packages/demobank-ui/src/context/backend.ts @@ -31,10 +31,10 @@ export type Type = BackendStateHandler; const initial: Type = { state: defaultState, - clear() { + logOut() { null; }, - save(info) { + logIn(info) { null; }, }; diff --git a/packages/demobank-ui/src/context/pageState.ts b/packages/demobank-ui/src/context/pageState.ts index fd7a6c90c..d5428b9b7 100644 --- a/packages/demobank-ui/src/context/pageState.ts +++ b/packages/demobank-ui/src/context/pageState.ts @@ -14,6 +14,7 @@ GNU Taler; see the file COPYING. If not, see <http://www.gnu.org/licenses/> */ +import { TranslatedString } from "@gnu-taler/taler-util"; import { useNotNullLocalStorage } from "@gnu-taler/web-util/lib/index.browser"; import { ComponentChildren, createContext, h, VNode } from "preact"; import { StateUpdater, useContext } from "preact/hooks"; @@ -29,7 +30,6 @@ export type Type = { }; const initial: Type = { pageState: { - isRawPayto: false, withdrawalInProgress: false, }, pageStateSetter: () => { @@ -58,7 +58,6 @@ export const PageStateProvider = ({ */ function usePageState( state: PageStateType = { - isRawPayto: false, withdrawalInProgress: false, }, ): [PageStateType, StateUpdater<PageStateType>] { @@ -92,24 +91,24 @@ function usePageState( return [retObj, removeLatestInfo]; } +export type ErrorMessage = { + description?: string; + title: TranslatedString; + debug?: string; +} /** * Track page state. */ export interface PageStateType { - isRawPayto: boolean; - withdrawalInProgress: boolean; - error?: { - description?: string; - title: string; - debug?: string; - }; + error?: ErrorMessage; + info?: TranslatedString; - info?: string; + withdrawalInProgress: boolean; talerWithdrawUri?: string; /** * Not strictly a presentational value, could * be moved in a future "withdrawal state" object. */ withdrawalId?: string; - timestamp?: number; + } |