* Normalizing “courseInfo” back into “course” Splitting it out denormalizes the data and introduces potential data inconsistencies. * Name component JSX files with the name of the component. * Normalizing some module exports/naming. * Moving alerts into a sub-directory. * DRYing up alert hook creation into reusable useAlert hook. * Adding some comments about ‘courses’ hydration.
10 lines
433 B
JavaScript
10 lines
433 B
JavaScript
/* eslint-disable import/prefer-default-export */
|
|
import { getAuthenticatedHttpClient } from '@edx/frontend-platform/auth';
|
|
import { getConfig } from '@edx/frontend-platform';
|
|
|
|
export async function postCourseEnrollment(courseId) {
|
|
const url = `${getConfig().LMS_BASE_URL}/api/enrollment/v1/enrollment`;
|
|
const { data } = await getAuthenticatedHttpClient().post(url, { course_details: { course_id: courseId } });
|
|
return data;
|
|
}
|