diff --git a/src/discussions/data/api.js b/src/discussions/data/api.js index 5f631ef55..9ddc21fcc 100644 --- a/src/discussions/data/api.js +++ b/src/discussions/data/api.js @@ -5,8 +5,10 @@ ensureConfig([ 'LMS_BASE_URL', ], 'Posts API service'); -export const getCourseConfigApiUrl = () => `${getConfig().LMS_BASE_URL}/api/discussion/v1/courses/`; +export const getCourseConfigApiUrl = () => `${getConfig().LMS_BASE_URL}/api/discussion/v2/courses/`; +export const getCourseSettingsApiUrl = () => `${getConfig().LMS_BASE_URL}/api/discussion/v1/courses/`; export const getDiscussionsConfigUrl = (courseId) => `${getCourseConfigApiUrl()}${courseId}/`; +export const getDiscussionsSettingsUrl = (courseId) => `${getCourseSettingsApiUrl()}${courseId}/settings`; /** * Get discussions course config * @param {string} courseId @@ -21,7 +23,7 @@ export async function getDiscussionsConfig(courseId) { * @param {string} courseId */ export async function getDiscussionsSettings(courseId) { - const url = `${getDiscussionsConfigUrl(courseId)}settings`; + const url = `${getDiscussionsSettingsUrl(courseId)}`; const { data } = await getAuthenticatedHttpClient().get(url); return data; } diff --git a/src/discussions/post-comments/PostCommentsView.test.jsx b/src/discussions/post-comments/PostCommentsView.test.jsx index 9f8588904..4f15c596c 100644 --- a/src/discussions/post-comments/PostCommentsView.test.jsx +++ b/src/discussions/post-comments/PostCommentsView.test.jsx @@ -18,7 +18,7 @@ import executeThunk from '../../test-utils'; import { getCohortsApiUrl } from '../cohorts/data/api'; import fetchCourseCohorts from '../cohorts/data/thunks'; import DiscussionContext from '../common/context'; -import { getCourseConfigApiUrl } from '../data/api'; +import { getCourseConfigApiUrl, getCourseSettingsApiUrl } from '../data/api'; import fetchCourseConfig from '../data/thunks'; import DiscussionContent from '../discussions-home/DiscussionContent'; import { getThreadsApiUrl } from '../posts/data/api'; @@ -37,6 +37,7 @@ import '../topics/data/__factories__'; import '../cohorts/data/__factories__'; const courseConfigApiUrl = getCourseConfigApiUrl(); +const courseSettingsApiUrl = getCourseSettingsApiUrl(); const commentsApiUrl = getCommentsApiUrl(); const threadsApiUrl = getThreadsApiUrl(); const discussionPostId = 'thread-1'; @@ -105,7 +106,7 @@ async function setupCourseConfig() { { code: 'reason-2', label: 'reason 2' }, ], }); - axiosMock.onGet(`${courseConfigApiUrl}${courseId}/settings`).reply(200, {}); + axiosMock.onGet(`${courseSettingsApiUrl}${courseId}/settings`).reply(200, {}); await executeThunk(fetchCourseConfig(courseId), store.dispatch, store.getState); }