aboutsummaryrefslogtreecommitdiffstats
path: root/packages/website/ts/components/inputs/allowance_toggle.tsx
diff options
context:
space:
mode:
authorFabio Berger <me@fabioberger.com>2018-01-31 04:27:21 +0800
committerGitHub <noreply@github.com>2018-01-31 04:27:21 +0800
commit1feac1a30886944ccadc00b2ff4f493e0d495301 (patch)
treebe68e9a62e3de3caf6e5e841899df16d8decc7e5 /packages/website/ts/components/inputs/allowance_toggle.tsx
parent2bcb7d56394c43acd68d1823092de2ad047abc6d (diff)
parentd3e42e4b3e2f893b616246d35f46dba92f251e83 (diff)
downloaddexon-sol-tools-1feac1a30886944ccadc00b2ff4f493e0d495301.tar.gz
dexon-sol-tools-1feac1a30886944ccadc00b2ff4f493e0d495301.tar.zst
dexon-sol-tools-1feac1a30886944ccadc00b2ff4f493e0d495301.zip
Merge pull request #351 from 0xProject/feature/portal-ledger-support
Portal Ledger Support, Lazy-loading token balances/allowances
Diffstat (limited to 'packages/website/ts/components/inputs/allowance_toggle.tsx')
-rw-r--r--packages/website/ts/components/inputs/allowance_toggle.tsx7
1 files changed, 5 insertions, 2 deletions
diff --git a/packages/website/ts/components/inputs/allowance_toggle.tsx b/packages/website/ts/components/inputs/allowance_toggle.tsx
index da46db4f4..45531e74b 100644
--- a/packages/website/ts/components/inputs/allowance_toggle.tsx
+++ b/packages/website/ts/components/inputs/allowance_toggle.tsx
@@ -17,6 +17,8 @@ interface AllowanceToggleProps {
token: Token;
tokenState: TokenState;
userAddress: string;
+ isDisabled: boolean;
+ refetchTokenStateAsync: () => Promise<void>;
}
interface AllowanceToggleState {
@@ -45,7 +47,7 @@ export class AllowanceToggle extends React.Component<AllowanceToggleProps, Allow
<div className="flex">
<div>
<Toggle
- disabled={this.state.isSpinnerVisible}
+ disabled={this.state.isSpinnerVisible || this.props.isDisabled}
toggled={this._isAllowanceSet()}
onToggle={this._onToggleAllowanceAsync.bind(this)}
/>
@@ -73,12 +75,13 @@ export class AllowanceToggle extends React.Component<AllowanceToggleProps, Allow
}
try {
await this.props.blockchain.setProxyAllowanceAsync(this.props.token, newAllowanceAmountInBaseUnits);
+ await this.props.refetchTokenStateAsync();
} catch (err) {
this.setState({
isSpinnerVisible: false,
});
const errMsg = `${err}`;
- if (_.includes(errMsg, 'User denied transaction')) {
+ if (utils.didUserDenyWeb3Request(errMsg)) {
return;
}
utils.consoleLog(`Unexpected error encountered: ${err}`);