* chore: removed eslint-disable statements * refactor: removed unnecessary files and unintentional eslint-disable statements * refactor: removed eslint import/no-cycle error * fix: failing testcase * style: removed comments * fix: failing testcase --------- Co-authored-by: sohailfatima <23100065@lums.edu.pk> Co-authored-by: Fatima Sohail <68312464+sohailfatima@users.noreply.github.com>
19 lines
615 B
JavaScript
19 lines
615 B
JavaScript
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;
|
|
}
|