In DownloadLink, don't check this.state.downloading on click
If this.state.downloading is true, the button will be disabled anyway.
This commit is contained in:
parent
468692b480
commit
12afb10cbc
1 changed files with 17 additions and 19 deletions
|
@ -103,29 +103,27 @@ var DownloadLink = React.createClass({
|
||||||
})
|
})
|
||||||
},
|
},
|
||||||
handleClick: function() {
|
handleClick: function() {
|
||||||
if (!this.state.downloading) { //@TODO: Continually update this.state.downloading based on actual status of file
|
this.setState({
|
||||||
this.setState({
|
downloading: true
|
||||||
downloading: true
|
});
|
||||||
});
|
|
||||||
|
|
||||||
lbry.getCostEstimate(this.props.streamName, (amount) => {
|
lbry.getCostEstimate(this.props.streamName, (amount) => {
|
||||||
lbry.getBalance((balance) => {
|
lbry.getBalance((balance) => {
|
||||||
if (amount > balance) {
|
if (amount > balance) {
|
||||||
|
this.setState({
|
||||||
|
modal: 'notEnoughCredits',
|
||||||
|
downloading: false
|
||||||
|
});
|
||||||
|
} else {
|
||||||
|
lbry.getStream(this.props.streamName, (streamInfo) => {
|
||||||
this.setState({
|
this.setState({
|
||||||
modal: 'notEnoughCredits',
|
modal: 'downloadStarted',
|
||||||
downloading: false
|
filePath: streamInfo.path,
|
||||||
});
|
});
|
||||||
} else {
|
});
|
||||||
lbry.getStream(this.props.streamName, (streamInfo) => {
|
}
|
||||||
this.setState({
|
|
||||||
modal: 'downloadStarted',
|
|
||||||
filePath: streamInfo.path,
|
|
||||||
});
|
|
||||||
});
|
|
||||||
}
|
|
||||||
});
|
|
||||||
});
|
});
|
||||||
}
|
});
|
||||||
},
|
},
|
||||||
render: function() {
|
render: function() {
|
||||||
var label = (!this.state.downloading ? this.props.label : this.props.downloadingLabel);
|
var label = (!this.state.downloading ? this.props.label : this.props.downloadingLabel);
|
||||||
|
|
Loading…
Reference in a new issue