Files
frontend-app-discussions/src/data/api.js
ayesha waris f69b2c118f chore: removed eslint-disable statements (#658)
* 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>
2024-01-31 16:54:03 +05:00

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;
}