Skip to content

Commit 48008f4

Browse files
authored
Merge pull request #196 from simranb86/issue_4541
fix for issue #4541
2 parents dc5c430 + e5c2886 commit 48008f4

File tree

1 file changed

+2
-15
lines changed

1 file changed

+2
-15
lines changed

src/services/challenges.js

+2-15
Original file line numberDiff line numberDiff line change
@@ -146,18 +146,12 @@ class ChallengesService {
146146
};
147147
const url = `${endpoint}?${qs.stringify(query)}`;
148148
const res = await this.private.apiV5.get(url).then(checkErrorV5);
149-
let myChallenges;
150-
if (typeof this.private.tokenV3 !== 'undefined') {
151-
const { userId } = decodeToken(this.private.tokenV3);
152-
myChallenges = await this.private.apiV5.get(`/resources/${userId}/challenges`)
153-
.then(checkErrorV5).then(userChallenges => userChallenges);
154-
}
155149
return {
156150
challenges: res.result || [],
157151
totalCount: res.headers.get('x-total'),
158152
meta: {
159153
allChallengesCount: res.headers.get('x-total'),
160-
myChallengesCount: (myChallenges && myChallenges.headers.get('x-total')) || 0,
154+
myChallengesCount: 0,
161155
ongoingChallengesCount: 0,
162156
openChallengesCount: 0,
163157
totalCount: res.headers.get('x-total'),
@@ -433,16 +427,9 @@ class ChallengesService {
433427
* @return {Promise} Resolves to the api response.
434428
*/
435429
async getChallenges(filters, params) {
436-
const memberId = this.private.tokenV3 ? decodeToken(this.private.tokenV3).userId : null;
437-
let userChallenges = [];
438-
if (memberId) {
439-
userChallenges = await this.private.apiV5.get(`/resources/${memberId}/challenges`)
440-
.then(checkErrorV5).then(res => res.result);
441-
}
442430
return this.private.getChallenges('/challenges/', filters, params)
443431
.then((res) => {
444-
res.challenges.forEach(item => normalizeChallenge(item,
445-
userChallenges.includes(item.id) ? memberId : null));
432+
res.challenges.forEach(item => normalizeChallenge(item));
446433
return res;
447434
});
448435
}

0 commit comments

Comments
 (0)