From 45cc53105686aed983fe3d2bc48b89d8e2552f59 Mon Sep 17 00:00:00 2001 From: fmtabbara Date: Fri, 10 Jun 2022 11:05:06 +0100 Subject: [PATCH] move setloading state --- nym-wallet/src/pages/send/SendWizard.tsx | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/nym-wallet/src/pages/send/SendWizard.tsx b/nym-wallet/src/pages/send/SendWizard.tsx index 6206878a73..5086a49cc7 100644 --- a/nym-wallet/src/pages/send/SendWizard.tsx +++ b/nym-wallet/src/pages/send/SendWizard.tsx @@ -62,6 +62,8 @@ export const SendWizard = () => { }; const handleSend = async () => { + setIsLoading(true); + const formState = methods.getValues(); const hasEnoughFunds = await checkHasEnoughFunds(formState.amount.amount); @@ -72,7 +74,6 @@ export const SendWizard = () => { handlePreviousStep(); return; } - setIsLoading(true); setActiveStep((s) => s + 1); send({ @@ -89,13 +90,14 @@ export const SendWizard = () => { ...details, tx_hash, }); - setIsLoading(false); userBalance.fetchBalance(); }) .catch((e) => { setRequestError(e); - setIsLoading(false); Console.error(e); + }) + .finally(() => { + setIsLoading(false); }); };