aboutsummaryrefslogtreecommitdiff
path: root/packages/taler-wallet-webextension/src/cta/Withdraw/state.ts
diff options
context:
space:
mode:
Diffstat (limited to 'packages/taler-wallet-webextension/src/cta/Withdraw/state.ts')
-rw-r--r--packages/taler-wallet-webextension/src/cta/Withdraw/state.ts32
1 files changed, 12 insertions, 20 deletions
diff --git a/packages/taler-wallet-webextension/src/cta/Withdraw/state.ts b/packages/taler-wallet-webextension/src/cta/Withdraw/state.ts
index cfca3a0f7..2e63c0f47 100644
--- a/packages/taler-wallet-webextension/src/cta/Withdraw/state.ts
+++ b/packages/taler-wallet-webextension/src/cta/Withdraw/state.ts
@@ -14,12 +14,6 @@
GNU Taler; see the file COPYING. If not, see <http://www.gnu.org/licenses/>
*/
-/**
- * Page shown to the user to confirm creation
- * of a reserve, usually requested by the bank.
- *
- * @author sebasjm
- */
import { Amounts } from "@gnu-taler/taler-util";
import { TalerError } from "@gnu-taler/taler-wallet-core";
@@ -133,17 +127,18 @@ export function useComponentState(
const [showExchangeSelection, setShowExchangeSelection] = useState(false);
const [nextExchange, setNextExchange] = useState<string | undefined>();
- if (!uriInfoHook || uriInfoHook.hasError) {
+ if (!uriInfoHook) return { status: "loading", error: undefined }
+ if (uriInfoHook.hasError) {
return {
status: "loading-uri",
- hook: uriInfoHook,
+ error: uriInfoHook,
};
}
if (!thisExchange || !amount) {
return {
status: "loading-exchange",
- hook: {
+ error: {
hasError: true,
operational: false,
message: "ERROR_NO-DEFAULT-EXCHANGE",
@@ -179,23 +174,20 @@ export function useComponentState(
{},
);
- if (!info || info.hasError) {
+ if (!info) {
+ return { status: "loading", error: undefined }
+ }
+ if (info.hasError) {
return {
status: "loading-info",
- hook: info,
+ error: info,
};
}
if (!info.response) {
- return {
- status: "loading-info",
- hook: undefined,
- };
+ return { status: "loading", error: undefined };
}
if (withdrawCompleted) {
- return {
- status: "completed",
- hook: undefined,
- };
+ return { status: "completed", error: undefined };
}
const exchangeHandler: SelectFieldHandler = {
@@ -263,7 +255,7 @@ export function useComponentState(
return {
status: "success",
- hook: undefined,
+ error: undefined,
exchange: exchangeHandler,
editExchange,
cancelEditExchange,