feat: improve course page

This commit is contained in:
swve 2022-11-15 00:14:14 +01:00
parent a8bad0427b
commit 6c12ee17f5
4 changed files with 138 additions and 22 deletions

View file

@ -15,7 +15,7 @@ export async function getOrgCourses(org_id: number) {
.catch((error) => console.log("error", error));
}
export async function getCourse(course_id: any) {
export async function getCourse(course_id: string) {
const HeadersConfig = new Headers({ "Content-Type": "application/json" });
const requestOptions: any = {
@ -31,6 +31,23 @@ export async function getCourse(course_id: any) {
.catch((error) => console.log("error", error));
}
export async function getCourseMetadata(course_id: string) {
const HeadersConfig = new Headers({ "Content-Type": "application/json" });
const requestOptions: any = {
method: "GET",
headers: HeadersConfig,
redirect: "follow",
credentials: "include",
};
// todo : add course id to url
return fetch(`${getAPIUrl()}courses/meta/${course_id}`, requestOptions)
.then((result) => result.json())
.catch((error) => console.log("error", error));
}
export async function createNewCourse(org_id: string, course_body: any, thumbnail: any) {
const HeadersConfig = new Headers();