Skip to content

Commit 5dc9187

Browse files
committed
fix: for issue #5036
1 parent 3deb718 commit 5dc9187

File tree

1 file changed

+9
-8
lines changed

1 file changed

+9
-8
lines changed

src/services/challenges.js

+9-8
Original file line numberDiff line numberDiff line change
@@ -169,20 +169,21 @@ class ChallengesService {
169169
endpoint,
170170
filter,
171171
) => {
172-
// console.log(filter);
173-
const query = getFilterUrl(filter.backendFilter, filter.frontFilter);
174-
const url = `${endpoint}?${query}`;
175-
// console.log(url);
176-
const res = await this.private.apiV5.get(url).then(checkErrorV5);
172+
let res = {};
173+
if (_.some(filter.frontFilter.tracks, val => val)) {
174+
const query = getFilterUrl(filter.backendFilter, filter.frontFilter);
175+
const url = `${endpoint}?${query}`;
176+
res = await this.private.apiV5.get(url).then(checkErrorV5);
177+
}
177178
return {
178179
challenges: res.result || [],
179-
totalCount: res.headers.get('x-total'),
180+
totalCount: res.headers ? res.headers.get('x-total') : 0,
180181
meta: {
181-
allChallengesCount: res.headers.get('x-total'),
182+
allChallengesCount: res.headers ? res.headers.get('x-total') : 0,
182183
myChallengesCount: 0,
183184
ongoingChallengesCount: 0,
184185
openChallengesCount: 0,
185-
totalCount: res.headers.get('x-total'),
186+
totalCount: res.headers ? res.headers.get('x-total') : 0,
186187
},
187188
};
188189
};

0 commit comments

Comments
 (0)