diff options
author | Thomas Schmidt <tomhschmidt@thomass-mbp-2.lan> | 2018-02-06 10:02:05 +0800 |
---|---|---|
committer | Thomas Schmidt <tomhschmidt@thomass-mbp-2.lan> | 2018-02-06 10:02:05 +0800 |
commit | 9d80a62bb18296c34824048b8ea2be5ad9b3515d (patch) | |
tree | 5fb7fae0e648838c4bd0d7c1411ce6657bc39c67 /packages/website/ts/components | |
parent | 83c7c8110d16eec7cd0e2267ee6755ece2ed7be4 (diff) | |
download | dexon-sol-tools-9d80a62bb18296c34824048b8ea2be5ad9b3515d.tar.gz dexon-sol-tools-9d80a62bb18296c34824048b8ea2be5ad9b3515d.tar.zst dexon-sol-tools-9d80a62bb18296c34824048b8ea2be5ad9b3515d.zip |
Moved to async await
Diffstat (limited to 'packages/website/ts/components')
-rw-r--r-- | packages/website/ts/components/inputs/allowance_toggle.tsx | 31 |
1 files changed, 13 insertions, 18 deletions
diff --git a/packages/website/ts/components/inputs/allowance_toggle.tsx b/packages/website/ts/components/inputs/allowance_toggle.tsx index 7d41d9633..0a42df71b 100644 --- a/packages/website/ts/components/inputs/allowance_toggle.tsx +++ b/packages/website/ts/components/inputs/allowance_toggle.tsx @@ -75,26 +75,21 @@ export class AllowanceToggle extends React.Component<AllowanceToggleProps, Allow newAllowanceAmountInBaseUnits = DEFAULT_ALLOWANCE_AMOUNT_IN_BASE_UNITS; } try { - await this.props.blockchain.setProxyAllowanceAsync(this.props.token, newAllowanceAmountInBaseUnits).then( - () => { - ReactGA.event({ - category: 'Portal', - action: 'Set Allowance Success', - label: this.props.token.symbol, - value: newAllowanceAmountInBaseUnits.toNumber(), - }); - }, - () => { - ReactGA.event({ - category: 'Portal', - action: 'Set Allowance Failure', - label: this.props.token.symbol, - value: newAllowanceAmountInBaseUnits.toNumber(), - }); - }, - ); + await this.props.blockchain.setProxyAllowanceAsync(this.props.token, newAllowanceAmountInBaseUnits) + ReactGA.event({ + category: 'Portal', + action: 'Set Allowance Success', + label: this.props.token.symbol, + value: newAllowanceAmountInBaseUnits.toNumber(), + }); await this.props.refetchTokenStateAsync(); } catch (err) { + ReactGA.event({ + category: 'Portal', + action: 'Set Allowance Failure', + label: this.props.token.symbol, + value: newAllowanceAmountInBaseUnits.toNumber(), + }); this.setState({ isSpinnerVisible: false, }); |