Skip to content
This repository was archived by the owner on Mar 13, 2025. It is now read-only.

Commit aba7ffd

Browse files
committed
Revert "Remove hard-coded v3 path for closing challenges."
This reverts commit d02e1c8.
1 parent c6ced2d commit aba7ffd

File tree

1 file changed

+5
-0
lines changed

1 file changed

+5
-0
lines changed

utils/topcoder-api-helper.js

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,7 @@ const m2m = m2mAuth(_.pick(config, ['AUTH0_URL', 'AUTH0_AUDIENCE', 'TOKEN_CACHE_
2525

2626
let topcoderApiProjects = require('topcoder-api-projects');
2727
let topcoderApiChallenges = require('@topcoder-platform/topcoder-api-challenges-v4-wrapper');
28+
let topcoderApiChallengesV3 = require('topcoder-api-challenges');
2829

2930
const topcoderDevApiProjects = require('topcoder-dev-api-projects');
3031
const topcoderDevApiChallenges = require('@topcoder-platform/topcoder-api-challenges-v4-wrapper-dev');
@@ -45,6 +46,7 @@ let cachedAccessToken;
4546
// Init the API instances
4647
const projectsClient = topcoderApiProjects.ApiClient.instance;
4748
const challengesClient = topcoderApiChallenges.ApiClient.instance;
49+
const challengesClientV3 = topcoderApiChallengesV3.ApiClient.instance;
4850

4951
// Timeout increase to 5 minutes
5052
challengesClient.timeout = 300000;
@@ -301,6 +303,9 @@ async function closeChallenge(id, winnerId) {
301303
logger.debug(`Closing challenge ${id}`);
302304
try {
303305
let basePath = challengesClient.basePath;
306+
if (!config.TC_DEV_ENV) {
307+
basePath = challengesClientV3.basePath;
308+
}
304309
const response = await axios.post(`${basePath}/challenges/${id}/close?winnerId=${winnerId}`, null, {
305310
headers: {
306311
authorization: `Bearer ${apiKey}`,

0 commit comments

Comments
 (0)