mirror of
https://github.com/rzmk/learnhouse.git
synced 2025-12-19 04:19:25 +00:00
feat: init collections index + delete
This commit is contained in:
parent
c5bb590b2d
commit
924656ce13
14 changed files with 167 additions and 22 deletions
37
front/services/orgs.ts
Normal file
37
front/services/orgs.ts
Normal file
|
|
@ -0,0 +1,37 @@
|
|||
import { getAPIUrl } from "./config";
|
||||
|
||||
export async function getUserOrganizations() {
|
||||
const HeadersConfig = new Headers({ "Content-Type": "application/json" });
|
||||
|
||||
const requestOptions: any = {
|
||||
method: "GET",
|
||||
headers: HeadersConfig,
|
||||
redirect: "follow",
|
||||
credentials: "include",
|
||||
};
|
||||
|
||||
return fetch(`${getAPIUrl()}orgs/user/page/1/limit/10`, requestOptions)
|
||||
.then((result) => result.json())
|
||||
.catch((error) => console.log("error", error));
|
||||
}
|
||||
|
||||
// export async function createNewOrganization(user_id) {}
|
||||
|
||||
// export async function getOrganizationData(org_id) {}
|
||||
|
||||
export async function deleteOrganizationFromBackend(org_id:any) {
|
||||
const HeadersConfig = new Headers({ "Content-Type": "application/json" });
|
||||
|
||||
const requestOptions: any = {
|
||||
method: "DELETE",
|
||||
headers: HeadersConfig,
|
||||
redirect: "follow",
|
||||
credentials: "include",
|
||||
};
|
||||
|
||||
return fetch(`${getAPIUrl()}orgs/${org_id}`, requestOptions)
|
||||
.then((result) => result.json())
|
||||
.catch((error) => console.log("error", error));
|
||||
}
|
||||
|
||||
// export async function updateOrganization(org_id) {}
|
||||
Loading…
Add table
Add a link
Reference in a new issue