mirror of
https://github.com/status-im/visual-identity.git
synced 2025-02-12 20:46:35 +00:00
display error message to user on fail
This commit is contained in:
parent
9603413242
commit
c5201fc0a6
@ -65,7 +65,8 @@ class Poll extends PureComponent {
|
|||||||
return updatePoll(idPoll);
|
return updatePoll(idPoll);
|
||||||
})
|
})
|
||||||
.catch(res => {
|
.catch(res => {
|
||||||
console.log('fail:', res);
|
console.log('fail:', res, res.messsage);
|
||||||
|
this.setState({ error: res.message })
|
||||||
})
|
})
|
||||||
.finally(() => {
|
.finally(() => {
|
||||||
this.getBalance();
|
this.getBalance();
|
||||||
@ -111,7 +112,7 @@ class Poll extends PureComponent {
|
|||||||
balance,
|
balance,
|
||||||
classes
|
classes
|
||||||
} = this.props;
|
} = this.props;
|
||||||
const { value, originalValue, isSubmitting } = this.state;
|
const { value, originalValue, isSubmitting, error } = this.state;
|
||||||
const cantVote = balance == 0 || !_canVote;
|
const cantVote = balance == 0 || !_canVote;
|
||||||
const disableVote = cantVote || isSubmitting;
|
const disableVote = cantVote || isSubmitting;
|
||||||
const { fromWei } = web3.utils;
|
const { fromWei } = web3.utils;
|
||||||
@ -131,6 +132,7 @@ class Poll extends PureComponent {
|
|||||||
{balance == 0 && <span>You can not vote because your account had no SNT when this poll was created</span>}
|
{balance == 0 && <span>You can not vote because your account had no SNT when this poll was created</span>}
|
||||||
{balance != 0 && !_canVote && <span>You can not vote on this poll</span>}
|
{balance != 0 && !_canVote && <span>You can not vote on this poll</span>}
|
||||||
</Typography>}
|
</Typography>}
|
||||||
|
{error && <Typography variant="body2" color="error">{error}</Typography>}
|
||||||
</CardContent>
|
</CardContent>
|
||||||
{!cantVote && <CardActions className={classes.card}>
|
{!cantVote && <CardActions className={classes.card}>
|
||||||
<Slider style={{ width: '95%' }} classes={{ thumb: classes.thumb }} disabled={disableVote} value={value || 0} min={0} max={maxValue} step={1} onChange={this.handleChange} />
|
<Slider style={{ width: '95%' }} classes={{ thumb: classes.thumb }} disabled={disableVote} value={value || 0} min={0} max={maxValue} step={1} onChange={this.handleChange} />
|
||||||
|
Loading…
x
Reference in New Issue
Block a user