(This reintroduces the change in 9f84230c that was later reverted by
67b0b33a.)
frontend-platform supports runtime configuration since 2.5.0 (see the PR
that introduced it[1], but it requires MFE cooperation. This implements
just that: by avoiding making configuration values constant, it should
now be possible to change them after initialization.
Almost all changes here relate to the `LMS_BASE_URL` setting, which in
most places was treated as a constant.
[1] https://github.com/openedx/frontend-platform/pull/335
20 lines
665 B
JavaScript
20 lines
665 B
JavaScript
/* eslint-disable import/prefer-default-export */
|
|
import { getAuthenticatedHttpClient } from '@edx/frontend-platform/auth';
|
|
|
|
import { getApiBaseUrl } from './constants';
|
|
|
|
export const getBlocksAPIURL = () => `${getApiBaseUrl()}/api/courses/v1/blocks/`;
|
|
export async function getCourseBlocks(courseId, username) {
|
|
const params = {
|
|
course_id: courseId,
|
|
username,
|
|
depth: 'all',
|
|
requested_fields: 'children,discussions_id',
|
|
block_types_filter: 'course,chapter,sequential,vertical,discussion',
|
|
student_view_data: 'discussion',
|
|
};
|
|
const { data } = await getAuthenticatedHttpClient()
|
|
.get(getBlocksAPIURL(), { params });
|
|
return data;
|
|
}
|