diff --git a/src/actions/challenge-listing.js b/src/actions/challenge-listing.js index e60f10f0..52999f0f 100644 --- a/src/actions/challenge-listing.js +++ b/src/actions/challenge-listing.js @@ -68,7 +68,7 @@ function getAll(getter, page = 0, prev) { } else { current = res; } - return getAll(getter, 1 + page, current); + return page === 0 ? current : getAll(getter, 1 + page, current); }); } @@ -195,10 +195,9 @@ function getActiveChallengesDone( user = decodeToken(tokenV3).handle; // Handle any errors on this endpoint so that the non-user specific challenges // will still be loaded. - calls.push(service.getUserChallenges(user, filter, { - limit: PAGE_SIZE, - offset: page * PAGE_SIZE, - }).catch(() => ({ challenges: [] }))); + calls.push(getAll( + params => service.getUserChallenges(user, filter, params).catch(() => ({ challenges: [] })), + )); } return Promise.all(calls).then(([ch, uch]) => { // let fullCH = ch;