Files
frontend-app-discussions/src/data/api.js
Kshitij Sobti 7f26f3a6ca feat: Add topic link to discussion post
Refactors the topics code and adds the topic relation box to posts.
2021-11-17 09:11:10 +05:30

20 lines
632 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',
block_types_filter: 'course,chapter,sequential,vertical,discussion',
student_view_data: 'discussion',
};
const { data } = await getAuthenticatedHttpClient()
.get(blocksAPIURL, { params });
return data;
}