From 96811b45e34475c5d9a074f0fa3959fd8b2646eb Mon Sep 17 00:00:00 2001 From: Dexter Edwards Date: Mon, 3 Oct 2022 09:17:40 +0100 Subject: [PATCH] fix: do not show success state if user cancels tx (#1562) --- apps/token/src/routes/staking/stake-success.tsx | 4 +++- apps/token/src/routes/staking/staking-form.tsx | 8 ++++++-- 2 files changed, 9 insertions(+), 3 deletions(-) diff --git a/apps/token/src/routes/staking/stake-success.tsx b/apps/token/src/routes/staking/stake-success.tsx index f2d8ed31e..1d858e151 100644 --- a/apps/token/src/routes/staking/stake-success.tsx +++ b/apps/token/src/routes/staking/stake-success.tsx @@ -34,7 +34,9 @@ export const StakeSuccess = ({

{message}

- {t('backToStaking')} + + {t('backToStaking')} +

diff --git a/apps/token/src/routes/staking/staking-form.tsx b/apps/token/src/routes/staking/staking-form.tsx index 7ab1f5b16..fd4076594 100644 --- a/apps/token/src/routes/staking/staking-form.tsx +++ b/apps/token/src/routes/staking/staking-form.tsx @@ -147,8 +147,12 @@ export const StakingForm = ({ }; try { const command = action === Actions.Add ? delegateInput : undelegateInput; - await sendTx(command); - setFormState(FormState.Pending); + const res = await sendTx(command); + if (res) { + setFormState(FormState.Pending); + } else { + setFormState(FormState.Default); + } // await success via poll } catch (err) {