fix: fixed course detail api params (#226)

* fix: fixed course detail api params

* test: fixed tests
This commit is contained in:
AsadAzam
2021-12-23 11:24:01 +05:00
committed by GitHub
parent a3e88a6c09
commit 3c6e50bfbc
3 changed files with 5 additions and 5 deletions

View File

@@ -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);
}

View File

@@ -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 }));

View File

@@ -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`);