Skip to content

Commit

Permalink
Fix to use v5 instead of v3 for member API
Browse files Browse the repository at this point in the history
  • Loading branch information
jmgasper committed Oct 19, 2023
1 parent a915431 commit 5b593a3
Showing 1 changed file with 10 additions and 10 deletions.
20 changes: 10 additions & 10 deletions src/api/users.js
Original file line number Diff line number Diff line change
Expand Up @@ -63,8 +63,8 @@ export function updateUserProfile(handle, updatedProfile, queryParams = {}) {
* @returns {Promise<Array>} member traits
*/
export const getMemberTraits = (handle) => {
return axios.get(`${TC_API_URL}/v3/members/${handle}/traits`)
.then(resp => _.get(resp.data, 'result.content', {}))
return axios.get(`${TC_API_URL}/v5/members/${handle}/traits`)
.then(resp => resp.data)
}

/**
Expand All @@ -76,10 +76,10 @@ export const getMemberTraits = (handle) => {
* @returns {Promise<Array>} member traits
*/
export const updateMemberTraits = (handle, updatedTraits) => {
return axios.put(`${TC_API_URL}/v3/members/${handle}/traits`, {
param: updatedTraits
})
.then(resp => _.get(resp.data, 'result.content', {}))
return axios.put(`${TC_API_URL}/v5/members/${handle}/traits`, (updatedTraits || []).map(traitInfo => {
return _.pick(traitInfo, ['categoryName', 'traitId', 'traits', ])
}))
.then(resp => resp.data)
}

/**
Expand All @@ -91,10 +91,10 @@ export const updateMemberTraits = (handle, updatedTraits) => {
* @returns {Promise<Array>} member traits
*/
export const createMemberTraits = (handle, traits) => {
return axios.post(`${TC_API_URL}/v3/members/${handle}/traits`, {
param: traits
})
.then(resp => _.get(resp.data, 'result.content', {}))
return axios.post(`${TC_API_URL}/v5/members/${handle}/traits`, (traits || []).map(traitInfo => {
return _.pick(traitInfo, ['categoryName', 'traitId', 'traits', ])
}))
.then(resp => resp.data)
}

/**
Expand Down

0 comments on commit 5b593a3

Please sign in to comment.