feat: init server side chapter add

This commit is contained in:
swve 2022-11-04 23:27:43 +01:00
parent ee69cb7e58
commit 5331e4db90
9 changed files with 729 additions and 11 deletions

View file

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