diff --git a/src/components/Delegations.js b/src/components/Delegations.js index 0e0c26dc..18d0ee21 100644 --- a/src/components/Delegations.js +++ b/src/components/Delegations.js @@ -69,12 +69,12 @@ class Delegations extends React.Component { refreshInterval(){ const interval = setInterval(() => { - this.getRewards() + this.getRewards(true) }, 15_000) this.setState({refreshInterval: interval}) } - getRewards() { + getRewards(hideError) { this.props.restClient.getRewards(this.props.address, this.props.network.denom) .then( (rewards) => { @@ -84,7 +84,7 @@ class Delegations extends React.Component { if([404, 500].includes(error.response && error.response.status)){ this.setState({ rewards: {} }); }else{ - this.setState({ error: 'Failed to get rewards. Please refresh' }); + if(!hideError) this.setState({ error: 'Failed to get rewards. Please refresh' }); } } ) diff --git a/src/components/Wallet.js b/src/components/Wallet.js index 4cc4d777..bd2012c9 100644 --- a/src/components/Wallet.js +++ b/src/components/Wallet.js @@ -42,7 +42,7 @@ class Wallet extends React.Component { refreshInterval(){ const interval = setInterval(() => { - this.getDelegations() + this.getDelegations(true) }, 30_000) this.setState({refreshInterval: interval}) } @@ -51,7 +51,7 @@ class Wallet extends React.Component { setTimeout(() => this.getDelegations(), 3_000) } - async getDelegations() { + async getDelegations(hideError) { this.props.restClient.getDelegations(this.props.address) .then( (delegations) => { @@ -61,14 +61,13 @@ class Wallet extends React.Component { }); }, (error) => { + this.setState({ isLoaded: true }) if([404, 500].includes(error.response && error.response.status)){ this.setState({ - isLoaded: true, - delegations: {}, + delegations: {} }); - }else{ + }else if(!hideError){ this.setState({ - isLoaded: true, error: 'Failed to load delegations. Please refresh.' }); }