mirror of
https://github.com/rzmk/learnhouse.git
synced 2025-12-19 04:19:25 +00:00
feat: save course chapters/elements
This commit is contained in:
parent
57e64a2b74
commit
3fe5f47eea
3 changed files with 59 additions and 14 deletions
|
|
@ -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);
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue