Fix: pagination support

This commit is contained in:
Thomas Zarebczan 2019-11-12 12:42:04 -05:00
parent d4829073e1
commit 2aedf5a188
3 changed files with 40 additions and 24 deletions

14
dist/bundle.es.js vendored
View file

@ -525,8 +525,11 @@ rewards.claimReward = (type, rewardParams) => {
switch (type) {
case rewards.TYPE_FIRST_CHANNEL:
lbryRedux.Lbry.claim_list().then(claims => {
const claim = claims.find(foundClaim => foundClaim.name.length && foundClaim.name[0] === '@' && foundClaim.txid.length && foundClaim.type === 'claim');
lbryRedux.Lbry.channel_list({
page: 1,
page_size: 10
}).then(claims => {
const claim = claims.items && claims.items.find(foundClaim => foundClaim.name.length && foundClaim.name[0] === '@' && foundClaim.txid.length && foundClaim.type === 'claim');
if (claim) {
params.transaction_id = claim.txid;
@ -538,8 +541,11 @@ rewards.claimReward = (type, rewardParams) => {
break;
case rewards.TYPE_FIRST_PUBLISH:
lbryRedux.Lbry.claim_list().then(claims => {
const claim = claims.find(foundClaim => foundClaim.name.length && foundClaim.name[0] !== '@' && foundClaim.txid.length && foundClaim.type === 'claim');
lbryRedux.Lbry.stream_list({
page: 1,
page_size: 10
}).then(claims => {
const claim = claims.items && claims.items.find(foundClaim => foundClaim.name.length && foundClaim.name[0] !== '@' && foundClaim.txid.length && foundClaim.type === 'claim');
if (claim) {
params.transaction_id = claim.txid;

14
dist/bundle.js vendored
View file

@ -1289,8 +1289,11 @@ rewards.claimReward = function (type, rewardParams) {
switch (type) {
case rewards.TYPE_FIRST_CHANNEL:
lbry_redux__WEBPACK_IMPORTED_MODULE_0__["Lbry"].claim_list().then(function (claims) {
var claim = claims.find(function (foundClaim) {
lbry_redux__WEBPACK_IMPORTED_MODULE_0__["Lbry"].channel_list({
page: 1,
page_size: 10
}).then(function (claims) {
var claim = claims.items && claims.items.find(function (foundClaim) {
return foundClaim.name.length && foundClaim.name[0] === '@' && foundClaim.txid.length && foundClaim.type === 'claim';
});
@ -1304,8 +1307,11 @@ rewards.claimReward = function (type, rewardParams) {
break;
case rewards.TYPE_FIRST_PUBLISH:
lbry_redux__WEBPACK_IMPORTED_MODULE_0__["Lbry"].claim_list().then(function (claims) {
var claim = claims.find(function (foundClaim) {
lbry_redux__WEBPACK_IMPORTED_MODULE_0__["Lbry"].stream_list({
page: 1,
page_size: 10
}).then(function (claims) {
var claim = claims.items && claims.items.find(function (foundClaim) {
return foundClaim.name.length && foundClaim.name[0] !== '@' && foundClaim.txid.length && foundClaim.type === 'claim';
});

View file

@ -53,15 +53,17 @@ rewards.claimReward = (type, rewardParams) => {
switch (type) {
case rewards.TYPE_FIRST_CHANNEL:
Lbry.claim_list()
Lbry.channel_list({ page: 1, page_size: 10 })
.then(claims => {
const claim = claims.find(
foundClaim =>
foundClaim.name.length &&
foundClaim.name[0] === '@' &&
foundClaim.txid.length &&
foundClaim.type === 'claim'
);
const claim =
claims.items &&
claims.items.find(
foundClaim =>
foundClaim.name.length &&
foundClaim.name[0] === '@' &&
foundClaim.txid.length &&
foundClaim.type === 'claim'
);
if (claim) {
params.transaction_id = claim.txid;
requestReward(resolve, reject, params);
@ -73,15 +75,17 @@ rewards.claimReward = (type, rewardParams) => {
break;
case rewards.TYPE_FIRST_PUBLISH:
Lbry.claim_list()
Lbry.stream_list({ page: 1, page_size: 10 })
.then(claims => {
const claim = claims.find(
foundClaim =>
foundClaim.name.length &&
foundClaim.name[0] !== '@' &&
foundClaim.txid.length &&
foundClaim.type === 'claim'
);
const claim =
claims.items &&
claims.items.find(
foundClaim =>
foundClaim.name.length &&
foundClaim.name[0] !== '@' &&
foundClaim.txid.length &&
foundClaim.type === 'claim'
);
if (claim) {
params.transaction_id = claim.txid;
requestReward(resolve, reject, params);