fix: do not show success state if user cancels tx (#1562)

This commit is contained in:
Dexter Edwards 2022-10-03 09:17:40 +01:00 committed by GitHub
parent 520f767d09
commit 96811b45e3
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 9 additions and 3 deletions

View File

@ -34,7 +34,9 @@ export const StakeSuccess = ({
<div> <div>
<p>{message}</p> <p>{message}</p>
<p> <p>
<Link to={Routes.STAKING}>{t('backToStaking')}</Link> <Link className="underline" to={Routes.STAKING}>
{t('backToStaking')}
</Link>
</p> </p>
</div> </div>
</Callout> </Callout>

View File

@ -147,8 +147,12 @@ export const StakingForm = ({
}; };
try { try {
const command = action === Actions.Add ? delegateInput : undelegateInput; const command = action === Actions.Add ? delegateInput : undelegateInput;
await sendTx(command); const res = await sendTx(command);
setFormState(FormState.Pending); if (res) {
setFormState(FormState.Pending);
} else {
setFormState(FormState.Default);
}
// await success via poll // await success via poll
} catch (err) { } catch (err) {