mirror of
https://github.com/rzmk/learnhouse.git
synced 2025-12-19 04:19:25 +00:00
feat: add courses index page + backend update
This commit is contained in:
parent
86fdd89b23
commit
4b623ae1b8
14 changed files with 218 additions and 50 deletions
16
front/services/courses.ts
Normal file
16
front/services/courses.ts
Normal 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));
|
||||
}
|
||||
|
|
@ -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));
|
||||
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue