mirror of
https://github.com/rzmk/learnhouse.git
synced 2025-12-19 04:19:25 +00:00
feat: reformat utility req functions to use next
This commit is contained in:
parent
1f6020efc0
commit
bb0f9166f9
14 changed files with 43 additions and 41 deletions
|
|
@ -7,14 +7,14 @@ import { RequestBody, errorHandling } from "@services/utils/ts/requests";
|
|||
*/
|
||||
|
||||
export async function deleteCollection(collection_id: any) {
|
||||
const result: any = await fetch(`${getAPIUrl()}collections/${collection_id}`, RequestBody("DELETE", null));
|
||||
const result: any = await fetch(`${getAPIUrl()}collections/${collection_id}`, RequestBody("DELETE", null, null));
|
||||
const res = await errorHandling(result);
|
||||
return res;
|
||||
}
|
||||
|
||||
// Create a new collection
|
||||
export async function createCollection(collection: any) {
|
||||
const result: any = await fetch(`${getAPIUrl()}collections/`, RequestBody("POST", collection));
|
||||
const result: any = await fetch(`${getAPIUrl()}collections/`, RequestBody("POST", collection, null));
|
||||
const res = await errorHandling(result);
|
||||
return res;
|
||||
}
|
||||
|
|
@ -22,7 +22,7 @@ export async function createCollection(collection: any) {
|
|||
// Get collections
|
||||
// TODO : add per org filter
|
||||
export async function getOrgCollections() {
|
||||
const result: any = await fetch(`${getAPIUrl()}collections/page/1/limit/10`);
|
||||
const result: any = await fetch(`${getAPIUrl()}collections/page/1/limit/10`, { next: { revalidate: 10 } });
|
||||
const res = await errorHandling(result);
|
||||
return res;
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue