mirror of
https://github.com/LBRYFoundation/lbry-desktop.git
synced 2025-09-01 01:35:11 +00:00
Merge pull request #145 from lbryio/fix-cost-error
Don't show error message if price for a file can't be retrieved
This commit is contained in:
commit
51142dfc53
2 changed files with 15 additions and 13 deletions
|
@ -28,6 +28,8 @@ let FilePrice = React.createClass({
|
||||||
costIncludesData: includesData,
|
costIncludesData: includesData,
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
}, () => {
|
||||||
|
// If we get an error looking up cost information, do nothing
|
||||||
});
|
});
|
||||||
},
|
},
|
||||||
|
|
||||||
|
|
26
js/lbry.js
26
js/lbry.js
|
@ -179,15 +179,15 @@ lbry.getMyClaim = function(name, callback) {
|
||||||
lbry.call('get_my_claim', { name: name }, callback);
|
lbry.call('get_my_claim', { name: name }, callback);
|
||||||
}
|
}
|
||||||
|
|
||||||
lbry.getKeyFee = function(name, callback) {
|
lbry.getKeyFee = function(name, callback, errorCallback) {
|
||||||
lbry.call('get_est_cost', { name: name }, callback);
|
lbry.call('stream_cost_estimate', { name: name }, callback, errorCallback);
|
||||||
}
|
}
|
||||||
|
|
||||||
lbry.getTotalCost = function(name, size, callback) {
|
lbry.getTotalCost = function(name, size, callback, errorCallback) {
|
||||||
lbry.call('get_est_cost', {
|
lbry.call('stream_cost_estimate', {
|
||||||
name: name,
|
name: name,
|
||||||
size: size,
|
size: size,
|
||||||
}, callback);
|
}, callback, errorCallback);
|
||||||
}
|
}
|
||||||
|
|
||||||
lbry.getPeersForBlobHash = function(blobHash, callback) {
|
lbry.getPeersForBlobHash = function(blobHash, callback) {
|
||||||
|
@ -205,7 +205,7 @@ lbry.getPeersForBlobHash = function(blobHash, callback) {
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
lbry.getCostInfoForName = function(name, callback) {
|
lbry.getCostInfoForName = function(name, callback, errorCallback) {
|
||||||
/**
|
/**
|
||||||
* Takes a LBRY name; will first try and calculate a total cost using
|
* Takes a LBRY name; will first try and calculate a total cost using
|
||||||
* Lighthouse. If Lighthouse can't be reached, it just retrives the
|
* Lighthouse. If Lighthouse can't be reached, it just retrives the
|
||||||
|
@ -216,30 +216,30 @@ lbry.getCostInfoForName = function(name, callback) {
|
||||||
* - includes_data: Boolean; indicates whether or not the data fee info
|
* - includes_data: Boolean; indicates whether or not the data fee info
|
||||||
* from Lighthouse is included.
|
* from Lighthouse is included.
|
||||||
*/
|
*/
|
||||||
function getCostWithData(name, size, callback) {
|
function getCostWithData(name, size, callback, errorCallback) {
|
||||||
lbry.getTotalCost(name, size, (cost) => {
|
lbry.getTotalCost(name, size, (cost) => {
|
||||||
callback({
|
callback({
|
||||||
cost: cost,
|
cost: cost,
|
||||||
includesData: true,
|
includesData: true,
|
||||||
});
|
});
|
||||||
});
|
}, errorCallback);
|
||||||
}
|
}
|
||||||
|
|
||||||
function getCostNoData(name, callback) {
|
function getCostNoData(name, callback, errorCallback) {
|
||||||
lbry.getKeyFee(name, (cost) => {
|
lbry.getKeyFee(name, (cost) => {
|
||||||
callback({
|
callback({
|
||||||
cost: cost,
|
cost: cost,
|
||||||
includesData: false,
|
includesData: false,
|
||||||
});
|
});
|
||||||
});
|
}, errorCallback);
|
||||||
}
|
}
|
||||||
|
|
||||||
lighthouse.getSizeForName(name, (size) => {
|
lighthouse.getSizeForName(name, (size) => {
|
||||||
getCostWithData(name, size, callback);
|
getCostWithData(name, size, callback, errorCallback);
|
||||||
}, () => {
|
}, () => {
|
||||||
getCostNoData(name, callback);
|
getCostNoData(name, callback, errorCallback);
|
||||||
}, () => {
|
}, () => {
|
||||||
getCostNoData(name, callback);
|
getCostNoData(name, callback, errorCallback);
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Add table
Reference in a new issue