fix: fixed course detail api params (#226)
* fix: fixed course detail api params * test: fixed tests
This commit is contained in:
@@ -9,9 +9,9 @@ function normalizeCourseDetail(data) {
|
||||
};
|
||||
}
|
||||
|
||||
export async function getCourseDetail(courseId) {
|
||||
export async function getCourseDetail(courseId, username) {
|
||||
const { data } = await getAuthenticatedHttpClient()
|
||||
.get(`${getConfig().LMS_BASE_URL}/api/courses/v1/courses/${courseId}`);
|
||||
.get(`${getConfig().LMS_BASE_URL}/api/courses/v1/courses/${courseId}?username=${username}`);
|
||||
|
||||
return normalizeCourseDetail(data);
|
||||
}
|
||||
|
||||
@@ -15,7 +15,7 @@ export function fetchCourseDetail(courseId) {
|
||||
dispatch(updateStatus({ courseId, status: LOADING }));
|
||||
|
||||
try {
|
||||
const courseDetail = await getCourseDetail(courseId);
|
||||
const courseDetail = await getCourseDetail(courseId, getAuthenticatedUser().username);
|
||||
dispatch(updateStatus({ courseId, status: LOADED }));
|
||||
|
||||
dispatch(addModel({ modelType: 'courseDetails', model: courseDetail }));
|
||||
|
||||
@@ -204,7 +204,7 @@ describe('DiscussionsSettings', () => {
|
||||
});
|
||||
|
||||
test('requires confirmation if changing provider', async () => {
|
||||
axiosMock.onGet(`${getConfig().LMS_BASE_URL}/api/courses/v1/courses/${courseId}`).reply(200, courseDetailResponse);
|
||||
axiosMock.onGet(`${getConfig().LMS_BASE_URL}/api/courses/v1/courses/${courseId}?username=abc123`).reply(200, courseDetailResponse);
|
||||
await executeThunk(fetchCourseDetail(courseId), store.dispatch);
|
||||
history.push(`/course/${courseId}/pages-and-resources/discussion`);
|
||||
|
||||
@@ -224,7 +224,7 @@ describe('DiscussionsSettings', () => {
|
||||
});
|
||||
|
||||
test('can cancel confirmation', async () => {
|
||||
axiosMock.onGet(`${getConfig().LMS_BASE_URL}/api/courses/v1/courses/${courseId}`).reply(200, courseDetailResponse);
|
||||
axiosMock.onGet(`${getConfig().LMS_BASE_URL}/api/courses/v1/courses/${courseId}?username=abc123`).reply(200, courseDetailResponse);
|
||||
await executeThunk(fetchCourseDetail(courseId), store.dispatch);
|
||||
history.push(`/course/${courseId}/pages-and-resources/discussion`);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user