aboutsummaryrefslogtreecommitdiff
path: root/packages/taler-wallet-webextension/src/cta/Withdraw/index.ts
diff options
context:
space:
mode:
authorSebastian <sebasjm@gmail.com>2022-07-30 20:55:41 -0300
committerSebastian <sebasjm@gmail.com>2022-08-01 10:55:17 -0300
commit614a3e3c8702bb7436398acb911880caae0fdee7 (patch)
tree18aed0268f98642f2ca4bc7b7ac23297ad4f2cc8 /packages/taler-wallet-webextension/src/cta/Withdraw/index.ts
parent979cd2daf2cca2ff14a8e8a2d68712358344e9c4 (diff)
downloadwallet-core-614a3e3c8702bb7436398acb911880caae0fdee7.tar.xz
standarizing components
Diffstat (limited to 'packages/taler-wallet-webextension/src/cta/Withdraw/index.ts')
-rw-r--r--packages/taler-wallet-webextension/src/cta/Withdraw/index.ts38
1 files changed, 19 insertions, 19 deletions
diff --git a/packages/taler-wallet-webextension/src/cta/Withdraw/index.ts b/packages/taler-wallet-webextension/src/cta/Withdraw/index.ts
index 75b44fe1e..1bf38721c 100644
--- a/packages/taler-wallet-webextension/src/cta/Withdraw/index.ts
+++ b/packages/taler-wallet-webextension/src/cta/Withdraw/index.ts
@@ -15,56 +15,57 @@
*/
import { AmountJson } from "@gnu-taler/taler-util";
-import { compose, StateViewMap } from "../../utils/index.js";
+import { Loading } from "../../components/Loading.js";
import { HookError } from "../../hooks/useAsyncAsHook.js";
import { ButtonHandler, SelectFieldHandler } from "../../mui/handlers.js";
+import { compose, StateViewMap } from "../../utils/index.js";
+import * as wxApi from "../../wxApi.js";
import {
Props as TermsOfServiceSectionProps
} from "../TermsOfServiceSection.js";
-import { CompletedView, LoadingExchangeView, LoadingInfoView, LoadingUriView, SuccessView } from "./views.js";
import { useComponentState } from "./state.js";
+import { CompletedView, LoadingExchangeView, LoadingInfoView, LoadingUriView, SuccessView } from "./views.js";
-/**
- * Page shown to the user to confirm creation
- * of a reserve, usually requested by the bank.
- *
- * @author sebasjm
- */
export interface Props {
talerWithdrawUri: string | undefined;
}
export type State =
- | State.LoadingUri
- | State.LoadingExchange
+ | State.Loading
+ | State.LoadingUriError
+ | State.LoadingExchangeError
| State.LoadingInfoError
| State.Success
| State.Completed;
export namespace State {
- export interface LoadingUri {
+ export interface Loading {
+ status: "loading";
+ error: undefined;
+ }
+ export interface LoadingUriError {
status: "loading-uri";
- hook: HookError | undefined;
+ error: HookError;
}
- export interface LoadingExchange {
+ export interface LoadingExchangeError {
status: "loading-exchange";
- hook: HookError | undefined;
+ error: HookError;
}
export interface LoadingInfoError {
status: "loading-info";
- hook: HookError | undefined;
+ error: HookError;
}
export type Completed = {
status: "completed";
- hook: undefined;
+ error: undefined;
};
export type Success = {
status: "success";
- hook: undefined;
+ error: undefined;
exchange: SelectFieldHandler;
@@ -86,6 +87,7 @@ export namespace State {
}
const viewMapping: StateViewMap<State> = {
+ loading: Loading,
"loading-uri": LoadingUriView,
"loading-exchange": LoadingExchangeView,
"loading-info": LoadingInfoView,
@@ -93,6 +95,4 @@ const viewMapping: StateViewMap<State> = {
success: SuccessView,
};
-import * as wxApi from "../../wxApi.js";
-
export const WithdrawPage = compose("Withdraw", (p: Props) => useComponentState(p, wxApi), viewMapping)