chore: refactor services folder

This commit is contained in:
swve 2023-03-23 22:30:11 +01:00
parent b16daaa780
commit 9ccf99a86f
35 changed files with 41 additions and 41 deletions

View file

@ -1,5 +1,5 @@
import { RequestBody } from "@services/utils/requests";
import { getAPIUrl } from "@services/config";
import { getAPIUrl } from "@services/config/config";
/*
This file includes only POST, PUT, DELETE requests

View file

@ -1,5 +1,5 @@
import { initialData } from "../../components/Drags/data";
import { getAPIUrl } from "@services/config";
import { getAPIUrl } from "@services/config/config";
import { RequestBody } from "@services/utils/requests";
/*

View file

@ -0,0 +1,20 @@
import { getAPIUrl } from "../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 deleteCollection(collection_id: any) {
return fetch(`${getAPIUrl()}collections/${collection_id}`, RequestBody("DELETE", null))
.then((result) => result.json())
.catch((error) => console.log("error", error));
}
// Create a new collection
export async function createCollection(collection: any) {
return fetch(`${getAPIUrl()}collections/`, RequestBody("POST", collection))
.then((result) => result.json())
.catch((error) => console.log("error", error));
}

View file

@ -1,4 +1,4 @@
import { getAPIUrl } from "@services/config";
import { getAPIUrl } from "@services/config/config";
import { RequestBody, RequestBodyForm } from "@services/utils/requests";
/*

View file

@ -1,4 +1,4 @@
import { getAPIUrl } from "@services/config";
import { getAPIUrl } from "@services/config/config";
import { RequestBody, RequestBodyForm } from "@services/utils/requests";
export async function createLecture(data: any, chapter_id: any, org_id: any) {