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>
<p>{message}</p>
<p>
<Link to={Routes.STAKING}>{t('backToStaking')}</Link>
<Link className="underline" to={Routes.STAKING}>
{t('backToStaking')}
</Link>
</p>
</div>
</Callout>

View File

@ -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) {