Skip to content

Commit 940b0a0

Browse files
authored
Merge pull request topcoder-platform#47 from topcoder-platform/feature/v5-members-api
use the v5 member API
2 parents 8b79074 + af397c1 commit 940b0a0

File tree

2 files changed

+5
-5
lines changed

2 files changed

+5
-5
lines changed

config/default.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ module.exports = {
2323
AUTH0_PROXY_SERVER_URL: process.env.AUTH0_PROXY_SERVER_URL,
2424

2525
TERMS_API_URL: process.env.TERMS_API_URL || 'https://api.topcoder-dev.com/v5/terms',
26-
MEMBER_API_URL: process.env.MEMBER_API_URL || 'https://api.topcoder-dev.com/v3/members',
26+
MEMBER_API_URL: process.env.MEMBER_API_URL || 'https://api.topcoder-dev.com/v5/members',
2727
USER_API_URL: process.env.USER_API_URL || 'https://api.topcoder-dev.com/v3/users',
2828
CHALLENGE_API_URL: process.env.CHALLENGE_API_URL || 'http://localhost:4000/v5/challenges',
2929
CHALLENGE_PHASES_API_URL: process.env.CHALLENGE_PHASES_API_URL || 'https://api.topcoder-dev.com/v5/challenge-phases',

src/common/helper.js

+4-4
Original file line numberDiff line numberDiff line change
@@ -177,13 +177,13 @@ async function getMemberIdByHandle (handle) {
177177
async function getMemberIdByHandleFromV3Members (handle) {
178178
let memberId
179179
try {
180-
logger.warn(`getMemberIdByHandle ${handle} from v3`)
180+
logger.warn(`getMemberIdByHandle ${handle} from v5`)
181181
const res = await getRequest(`${config.MEMBER_API_URL}/${handle}`)
182-
if (_.get(res, 'body.result.content.userId')) {
183-
memberId = String(res.body.result.content.userId)
182+
if (_.get(res, 'body.userId')) {
183+
memberId = String(res.body.userId)
184184
}
185185
// handle return from v3 API, handle and memberHandle are the same under case-insensitive condition
186-
handle = _.get(res, 'body.result.content.handle')
186+
handle = _.get(res, 'body.handle')
187187
} catch (error) {
188188
// re-throw all error except 404 Not-Founded, BadRequestError should be thrown if 404 occurs
189189
if (error.status !== 404) {

0 commit comments

Comments
 (0)