Files
frontend-app-authoring/src/data/api.js
AsadAzam 3c6e50bfbc fix: fixed course detail api params (#226)
* fix: fixed course detail api params

* test: fixed tests
2021-12-23 11:24:01 +05:00

18 lines
558 B
JavaScript

/* eslint-disable import/prefer-default-export */
import { camelCaseObject, getConfig } from '@edx/frontend-platform';
import { getAuthenticatedHttpClient } from '@edx/frontend-platform/auth';
function normalizeCourseDetail(data) {
return {
id: data.course_id,
...camelCaseObject(data),
};
}
export async function getCourseDetail(courseId, username) {
const { data } = await getAuthenticatedHttpClient()
.get(`${getConfig().LMS_BASE_URL}/api/courses/v1/courses/${courseId}?username=${username}`);
return normalizeCourseDetail(data);
}