File tree 1 file changed +9
-8
lines changed
1 file changed +9
-8
lines changed Original file line number Diff line number Diff line change @@ -169,20 +169,21 @@ class ChallengesService {
169
169
endpoint ,
170
170
filter ,
171
171
) => {
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
+ }
177
178
return {
178
179
challenges : res . result || [ ] ,
179
- totalCount : res . headers . get ( 'x-total' ) ,
180
+ totalCount : res . headers ? res . headers . get ( 'x-total' ) : 0 ,
180
181
meta : {
181
- allChallengesCount : res . headers . get ( 'x-total' ) ,
182
+ allChallengesCount : res . headers ? res . headers . get ( 'x-total' ) : 0 ,
182
183
myChallengesCount : 0 ,
183
184
ongoingChallengesCount : 0 ,
184
185
openChallengesCount : 0 ,
185
- totalCount : res . headers . get ( 'x-total' ) ,
186
+ totalCount : res . headers ? res . headers . get ( 'x-total' ) : 0 ,
186
187
} ,
187
188
} ;
188
189
} ;
You can’t perform that action at this time.
0 commit comments