feat: save course chapters/elements

This commit is contained in:
swve 2022-11-13 22:33:05 +01:00
parent 57e64a2b74
commit 3fe5f47eea
3 changed files with 59 additions and 14 deletions

View file

@ -20,6 +20,26 @@ export async function getCourseChaptersMetadata(course_id: any) {
return data;
}
export async function updateChaptersMetadata(course_id: any, data: any) {
const HeadersConfig = new Headers({ "Content-Type": "application/json" });
const requestOptions: any = {
method: "PUT",
headers: HeadersConfig,
redirect: "follow",
credentials: "include",
body: JSON.stringify(data),
};
const result: any = await fetch(`${getAPIUrl()}chapters/meta/course_${course_id}`, requestOptions)
.then((result) => result.json())
.catch((error) => console.log("error", error));
console.log("result", result);
return result;
}
export async function createChapter(data: any, course_id: any) {
console.log("data", data, course_id);