feat: [FC-0044] Course unit - Copy/paste functionality (#884)

Implement copy/paste.

Co-authored-by: monteri <36768631+monteri@users.noreply.github.com>
Co-authored-by: ihor-romaniuk <ihor.romaniuk@raccoongang.com>
This commit is contained in:
Peter Kulko
2024-04-24 21:27:29 +03:00
committed by GitHub
parent bef6796da4
commit 5686dee43b
69 changed files with 1621 additions and 404 deletions

View File

@@ -11,7 +11,6 @@ export const getCourseUnitApiUrl = (itemId) => `${getStudioBaseUrl()}/xblock/con
export const getXBlockBaseApiUrl = (itemId) => `${getStudioBaseUrl()}/xblock/${itemId}`;
export const getCourseSectionVerticalApiUrl = (itemId) => `${getStudioBaseUrl()}/api/contentstore/v1/container_handler/${itemId}`;
export const getCourseVerticalChildrenApiUrl = (itemId) => `${getStudioBaseUrl()}/api/contentstore/v1/container/vertical/${itemId}/children`;
export const postXBlockBaseApiUrl = () => `${getStudioBaseUrl()}/xblock/`;
/**
@@ -60,13 +59,13 @@ export async function getCourseSectionVerticalData(unitId) {
* @param {Object} options - The options for creating the XBlock.
* @param {string} options.type - The type of the XBlock.
* @param {string} [options.category] - The category of the XBlock. Defaults to the type if not provided.
* @param {string} options.parentLocator - The parent locator of the XBlock.
* @param {string} [options.displayName] - The display name for the XBlock.
* @param {string} [options.boilerplate] - The boilerplate for the XBlock.
* @returns {Promise<Object>} A Promise that resolves to the created XBlock data.
* @param {string} options.parentLocator - The parent locator.
* @param {string} [options.displayName] - The display name.
* @param {string} [options.boilerplate] - The boilerplate.
* @param {string} [options.stagedContent] - The staged content.
*/
export async function createCourseXblock({
type, category, parentLocator, displayName, boilerplate,
type, category, parentLocator, displayName, boilerplate, stagedContent,
}) {
const body = {
type,
@@ -74,6 +73,7 @@ export async function createCourseXblock({
category: category || type,
parent_locator: parentLocator,
display_name: displayName,
staged_content: stagedContent,
};
const { data } = await getAuthenticatedHttpClient()