mirror of
https://github.com/rzmk/learnhouse.git
synced 2025-12-19 04:19:25 +00:00
chore: refactor services folder
This commit is contained in:
parent
b16daaa780
commit
9ccf99a86f
35 changed files with 41 additions and 41 deletions
25
front/services/organizations/orgs.ts
Normal file
25
front/services/organizations/orgs.ts
Normal file
|
|
@ -0,0 +1,25 @@
|
|||
import { getAPIUrl } from "@services/config/config";
|
||||
import { RequestBody } from "../utils/requests";
|
||||
|
||||
/*
|
||||
This file includes only POST, PUT, DELETE requests
|
||||
GET requests are called from the frontend using SWR (https://swr.vercel.app/)
|
||||
*/
|
||||
|
||||
export async function createNewOrganization(body: any) {
|
||||
return fetch(`${getAPIUrl()}orgs/`, RequestBody("POST", body))
|
||||
.then((result) => result.json())
|
||||
.catch((error) => console.log("error", error));
|
||||
}
|
||||
|
||||
export async function deleteOrganizationFromBackend(org_id: any) {
|
||||
return fetch(`${getAPIUrl()}orgs/${org_id}`, RequestBody("DELETE", null))
|
||||
.then((result) => result.json())
|
||||
.catch((error) => console.log("error", error));
|
||||
}
|
||||
|
||||
export async function getOrganizationContextInfo(org_slug: any) {
|
||||
return fetch(`${getAPIUrl()}orgs/slug/${org_slug}`, RequestBody("GET", null))
|
||||
.then((result) => result.json())
|
||||
.catch((error) => console.log("error", error));
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue