@@ -11,7 +11,7 @@ import { decodeToken } from 'tc-accounts';
11
11
import logger from '../utils/logger' ;
12
12
import { setErrorIcon , ERROR_ICON_TYPES } from '../utils/errors' ;
13
13
import { COMPETITION_TRACKS , getApiResponsePayload } from '../utils/tc' ;
14
- import { getApi , proxyApi } from './api' ;
14
+ import { getApi } from './api' ;
15
15
import { getService as getMembersService } from './members' ;
16
16
17
17
export const ORDER_BY = {
@@ -200,7 +200,6 @@ class ChallengesService {
200
200
apiV3 : getApi ( 'V3' , tokenV3 ) ,
201
201
getChallenges,
202
202
getMemberChallenges,
203
- proxyApi,
204
203
tokenV2,
205
204
tokenV3,
206
205
memberService : getMembersService ( ) ,
@@ -360,7 +359,19 @@ class ChallengesService {
360
359
* @return {Promise } Resolves to the challenge registrants array.
361
360
*/
362
361
async getChallengeRegistrants ( challengeId ) {
363
- const registrants = await this . private . proxyApi ( `/challenges/${ challengeId } /registrants` ) ;
362
+ const roleId = await this . getRoleId ( 'Submitter' ) ;
363
+ const params = {
364
+ challengeId,
365
+ roleId,
366
+ } ;
367
+
368
+ const registrants = await this . private . apiV5 . get ( `/resources?${ qs . stringify ( params ) } ` )
369
+ . then ( checkErrorV5 ) . then ( res => res . result ) ;
370
+
371
+ if ( _ . isEmpty ( registrants ) ) {
372
+ throw new Error ( 'Resource Role not found!' ) ;
373
+ }
374
+
364
375
return registrants || [ ] ;
365
376
}
366
377
@@ -526,8 +537,10 @@ class ChallengesService {
526
537
async getRoleId ( roleName ) {
527
538
const params = {
528
539
name : roleName ,
540
+ isActive : true ,
529
541
} ;
530
- const roles = await this . private . proxyApi ( `/challenges/roleId?${ qs . stringify ( params ) } ` ) ;
542
+ const roles = await this . private . apiV5 . get ( `/resource-roles?${ qs . stringify ( params ) } ` )
543
+ . then ( checkErrorV5 ) . then ( res => res . result ) ;
531
544
532
545
if ( _ . isEmpty ( roles ) ) {
533
546
throw new Error ( 'Resource Role not found!' ) ;
0 commit comments