feat: add courses index page + backend update

This commit is contained in:
swve 2022-10-01 10:16:35 +02:00
parent 86fdd89b23
commit 4b623ae1b8
14 changed files with 218 additions and 50 deletions

16
front/services/courses.ts Normal file
View file

@ -0,0 +1,16 @@
import { getAPIUrl } from "./config";
export async function getOrgCourses(org_id: number) {
const HeadersConfig = new Headers({ "Content-Type": "application/json" });
const requestOptions: any = {
method: "GET",
headers: HeadersConfig,
redirect: "follow",
credentials: "include",
};
return fetch(`${getAPIUrl()}courses/${org_id}/page/1/limit/10`, requestOptions)
.then((result) => result.json())
.catch((error) => console.log("error", error));
}

View file

@ -49,3 +49,19 @@ export async function deleteOrganizationFromBackend(org_id: any) {
}
// export async function updateOrganization(org_id) {}
export async function getOrganizationContextInfo(org_slug : any){
const HeadersConfig = new Headers({ "Content-Type": "application/json" });
const requestOptions: any = {
method: "GET",
headers: HeadersConfig,
redirect: "follow",
credentials: "include",
};
return fetch(`${getAPIUrl()}orgs/slug/${org_slug}`, requestOptions)
.then((result) => result.json())
.catch((error) => console.log("error", error));
}