Fix: pagination support #75

Merged
tzarebczan merged 1 commit from 0.45-support into master 2019-11-13 22:32:17 +01:00
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) { switch (type) {
case rewards.TYPE_FIRST_CHANNEL: case rewards.TYPE_FIRST_CHANNEL:
lbryRedux.Lbry.claim_list().then(claims => { lbryRedux.Lbry.channel_list({
const claim = claims.find(foundClaim => foundClaim.name.length && foundClaim.name[0] === '@' && foundClaim.txid.length && foundClaim.type === 'claim'); 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) { if (claim) {
params.transaction_id = claim.txid; params.transaction_id = claim.txid;
@ -538,8 +541,11 @@ rewards.claimReward = (type, rewardParams) => {
break; break;
case rewards.TYPE_FIRST_PUBLISH: case rewards.TYPE_FIRST_PUBLISH:
lbryRedux.Lbry.claim_list().then(claims => { lbryRedux.Lbry.stream_list({
const claim = claims.find(foundClaim => foundClaim.name.length && foundClaim.name[0] !== '@' && foundClaim.txid.length && foundClaim.type === 'claim'); 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) { if (claim) {
params.transaction_id = claim.txid; params.transaction_id = claim.txid;

14
dist/bundle.js vendored
View file

@ -1289,8 +1289,11 @@ rewards.claimReward = function (type, rewardParams) {
switch (type) { switch (type) {
case rewards.TYPE_FIRST_CHANNEL: case rewards.TYPE_FIRST_CHANNEL:
lbry_redux__WEBPACK_IMPORTED_MODULE_0__["Lbry"].claim_list().then(function (claims) { lbry_redux__WEBPACK_IMPORTED_MODULE_0__["Lbry"].channel_list({
var claim = claims.find(function (foundClaim) { 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'; return foundClaim.name.length && foundClaim.name[0] === '@' && foundClaim.txid.length && foundClaim.type === 'claim';
}); });
@ -1304,8 +1307,11 @@ rewards.claimReward = function (type, rewardParams) {
break; break;
case rewards.TYPE_FIRST_PUBLISH: case rewards.TYPE_FIRST_PUBLISH:
lbry_redux__WEBPACK_IMPORTED_MODULE_0__["Lbry"].claim_list().then(function (claims) { lbry_redux__WEBPACK_IMPORTED_MODULE_0__["Lbry"].stream_list({
var claim = claims.find(function (foundClaim) { 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'; 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) { switch (type) {
case rewards.TYPE_FIRST_CHANNEL: case rewards.TYPE_FIRST_CHANNEL:
Lbry.claim_list() Lbry.channel_list({ page: 1, page_size: 10 })
.then(claims => { .then(claims => {
const claim = claims.find( const claim =
foundClaim => claims.items &&
foundClaim.name.length && claims.items.find(
foundClaim.name[0] === '@' && foundClaim =>
foundClaim.txid.length && foundClaim.name.length &&
foundClaim.type === 'claim' foundClaim.name[0] === '@' &&
); foundClaim.txid.length &&
foundClaim.type === 'claim'
);
if (claim) { if (claim) {
params.transaction_id = claim.txid; params.transaction_id = claim.txid;
requestReward(resolve, reject, params); requestReward(resolve, reject, params);
@ -73,15 +75,17 @@ rewards.claimReward = (type, rewardParams) => {
break; break;
case rewards.TYPE_FIRST_PUBLISH: case rewards.TYPE_FIRST_PUBLISH:
Lbry.claim_list() Lbry.stream_list({ page: 1, page_size: 10 })
.then(claims => { .then(claims => {
const claim = claims.find( const claim =
foundClaim => claims.items &&
foundClaim.name.length && claims.items.find(
foundClaim.name[0] !== '@' && foundClaim =>
foundClaim.txid.length && foundClaim.name.length &&
foundClaim.type === 'claim' foundClaim.name[0] !== '@' &&
); foundClaim.txid.length &&
foundClaim.type === 'claim'
);
if (claim) { if (claim) {
params.transaction_id = claim.txid; params.transaction_id = claim.txid;
requestReward(resolve, reject, params); requestReward(resolve, reject, params);