feat: init collections index + delete

This commit is contained in:
swve 2022-09-24 20:06:05 +02:00
parent c5bb590b2d
commit 924656ce13
14 changed files with 167 additions and 22 deletions

37
front/services/orgs.ts Normal file
View 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) {}