Adds support for the new openedx provider and the new topics structure it introduces which ses the new topics v2 API.
20 lines
647 B
JavaScript
20 lines
647 B
JavaScript
/* eslint-disable import/prefer-default-export */
|
|
import { getAuthenticatedHttpClient } from '@edx/frontend-platform/auth';
|
|
|
|
import { API_BASE_URL } from './constants';
|
|
|
|
export const blocksAPIURL = `${API_BASE_URL}/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(blocksAPIURL, { params });
|
|
return data;
|
|
}
|