Files
frontend-app-discussions/src/data/api.js
Kshitij Sobti d31c438fc1 feat: add support for new provider and new topic api (#54)
Adds support for the new openedx provider and the new topics structure it introduces which ses the new topics v2 API.
2022-03-02 08:13:44 +00:00

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