From 2dfe14c4605cfc3980faff0274603cb2e9035e8a Mon Sep 17 00:00:00 2001 From: Justin Gasper Date: Mon, 20 Nov 2023 16:28:28 +1100 Subject: [PATCH] Update the URL for saving skills --- config/constants/development.js | 3 +-- config/constants/production.js | 3 +-- src/actions/challenges.js | 12 ++++++------ src/config/constants.js | 3 +-- src/services/challenges.js | 4 ++-- 5 files changed, 11 insertions(+), 14 deletions(-) diff --git a/config/constants/development.js b/config/constants/development.js index 19d232bf..07d39092 100644 --- a/config/constants/development.js +++ b/config/constants/development.js @@ -55,6 +55,5 @@ module.exports = { HEADER_AUTH_URLS_HREF: `https://accounts-auth0.${DOMAIN}?utm_source=community-app-main`, HEADER_AUTH_URLS_LOCATION: `https://accounts-auth0.${DOMAIN}?retUrl=%S&utm_source=community-app-main`, SKILLS_V5_API_URL: `${API_V5}/standardized-skills/skills/autocomplete`, - UPDATE_SKILLS_V5_API_URL: `${API_V5}/standardized-skills/work-skills`, - WORK_TYPE_ID: '4d2bdbc8-eb3b-4156-8d20-98a46589cc5d' + UPDATE_SKILLS_V5_API_URL: `${API_V5}/standardized-skills/challenge-skills` } diff --git a/config/constants/production.js b/config/constants/production.js index cff76956..6e5e6e64 100644 --- a/config/constants/production.js +++ b/config/constants/production.js @@ -52,6 +52,5 @@ module.exports = { HEADER_AUTH_URLS_HREF: `https://accounts-auth0.${DOMAIN}?utm_source=community-app-main`, HEADER_AUTH_URLS_LOCATION: `https://accounts-auth0.${DOMAIN}?retUrl=%S&utm_source=community-app-main`, SKILLS_V5_API_URL: `${API_V5}/standardized-skills/skills/autocomplete`, - UPDATE_SKILLS_V5_API_URL: `${API_V5}/standardized-skills/work-skills`, - WORK_TYPE_ID: '4d2bdbc8-eb3b-4156-8d20-98a46589cc5d' + UPDATE_SKILLS_V5_API_URL: `${API_V5}/standardized-skills/challenge-skills` } diff --git a/src/actions/challenges.js b/src/actions/challenges.js index ee284b8f..7349d179 100644 --- a/src/actions/challenges.js +++ b/src/actions/challenges.js @@ -53,7 +53,6 @@ import { LOAD_CHALLENGE_RESOURCES_SUCCESS, LOAD_CHALLENGE_RESOURCES_PENDING, LOAD_CHALLENGE_RESOURCES_FAILURE, - WORK_TYPE_ID, UPDATE_CHALLENGES_SKILLS_SUCCESS } from '../config/constants' import { loadProject } from './projects' @@ -746,11 +745,12 @@ export function updateChallengeSkills (challengeId, skills) { if (!skills) { return } - await updateChallengeSkillsApi({ - workId: challengeId, - workTypeId: WORK_TYPE_ID, - skillIds: skills.map(skill => skill.id) - }) + await updateChallengeSkillsApi( + challengeId, + { + skillIds: skills.map(skill => skill.id) + } + ) dispatch({ type: UPDATE_CHALLENGES_SKILLS_SUCCESS, payload: skills diff --git a/src/config/constants.js b/src/config/constants.js index aba789d8..8542258a 100644 --- a/src/config/constants.js +++ b/src/config/constants.js @@ -29,8 +29,7 @@ export const { API_V4, API_V5, SKILLS_V5_API_URL, - UPDATE_SKILLS_V5_API_URL, - WORK_TYPE_ID + UPDATE_SKILLS_V5_API_URL } = process.env export const CREATE_FORUM_TYPE_IDS = typeof process.env.CREATE_FORUM_TYPE_IDS === 'string' ? process.env.CREATE_FORUM_TYPE_IDS.split(',') : process.env.CREATE_FORUM_TYPE_IDS diff --git a/src/services/challenges.js b/src/services/challenges.js index 2d5db99f..0abab43d 100644 --- a/src/services/challenges.js +++ b/src/services/challenges.js @@ -291,7 +291,7 @@ export async function deleteResource (resource) { * @param {Object} skills data * @returns {Promise<*>} */ -export async function updateChallengeSkillsApi (skills) { - const resp = await axiosInstance.post(UPDATE_SKILLS_V5_API_URL, skills) +export async function updateChallengeSkillsApi (challengeId, skills) { + const resp = await axiosInstance.post(`${UPDATE_SKILLS_V5_API_URL}/${challengeId}`, skills) return _.get(resp, 'data', {}) }