Skip to content

Commit e5c2886

Browse files
committed
fix for issue #4541
1 parent ce75876 commit e5c2886

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'),
@@ -440,16 +434,9 @@ class ChallengesService {
440434
* @return {Promise} Resolves to the api response.
441435
*/
442436
async getChallenges(filters, params) {
443-
const memberId = this.private.tokenV3 ? decodeToken(this.private.tokenV3).userId : null;
444-
let userChallenges = [];
445-
if (memberId) {
446-
userChallenges = await this.private.apiV5.get(`/resources/${memberId}/challenges`)
447-
.then(checkErrorV5).then(res => res.result);
448-
}
449437
return this.private.getChallenges('/challenges/', filters, params)
450438
.then((res) => {
451-
res.challenges.forEach(item => normalizeChallenge(item,
452-
userChallenges.includes(item.id) ? memberId : null));
439+
res.challenges.forEach(item => normalizeChallenge(item));
453440
return res;
454441
});
455442
}

0 commit comments

Comments
 (0)