mirror of
https://github.com/rzmk/learnhouse.git
synced 2025-12-19 04:19:25 +00:00
feat: init server side chapter add
This commit is contained in:
parent
ee69cb7e58
commit
5331e4db90
9 changed files with 729 additions and 11 deletions
|
|
@ -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;
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue