Merge pull request #108 from lbryio/update-download-watch-links

Update logic in Download and Watch links
This commit is contained in:
alexliebowitz 2016-12-16 18:36:22 -05:00 committed by GitHub
commit 59b31c1803

View file

@ -113,16 +113,16 @@ export let DownloadLink = React.createClass({
downloading: true
});
lbry.getCostEstimate(this.props.streamName, (amount) => {
lbry.getCostInfoForName(this.props.streamName, ({cost}) => {
lbry.getBalance((balance) => {
if (amount > balance) {
if (cost > balance) {
this.setState({
modal: 'notEnoughCredits',
downloading: false
});
} else {
lbry.getStream(this.props.streamName, (streamInfo) => {
if (typeof streamInfo !== 'object') {
if (streamInfo === null || typeof streamInfo !== 'object') {
this.setState({
modal: 'timedOut',
downloading: false,
@ -172,9 +172,9 @@ export let WatchLink = React.createClass({
this.setState({
loading: true,
})
lbry.getCostEstimate(this.props.streamName, (amount) => {
lbry.getCostInfoForName(this.props.streamName, ({cost}) => {
lbry.getBalance((balance) => {
if (amount > balance) {
if (cost > balance) {
this.setState({
modal: 'notEnoughCredits',
loading: false,