mirror of
https://github.com/rzmk/learnhouse.git
synced 2025-12-19 04:19:25 +00:00
feat: format with prettier
This commit is contained in:
parent
03fb09c3d6
commit
a147ad6610
164 changed files with 11257 additions and 8154 deletions
|
|
@ -1,5 +1,9 @@
|
|||
import { getAPIUrl } from "../config/config";
|
||||
import { RequestBody, RequestBodyWithAuthHeader, errorHandling } from "@services/utils/ts/requests";
|
||||
import { getAPIUrl } from '../config/config'
|
||||
import {
|
||||
RequestBody,
|
||||
RequestBodyWithAuthHeader,
|
||||
errorHandling,
|
||||
} from '@services/utils/ts/requests'
|
||||
|
||||
/*
|
||||
This file includes only POST, PUT, DELETE requests
|
||||
|
|
@ -7,41 +11,66 @@ import { RequestBody, RequestBodyWithAuthHeader, errorHandling } from "@services
|
|||
*/
|
||||
|
||||
export async function deleteCollection(collection_uuid: any) {
|
||||
const result: any = await fetch(`${getAPIUrl()}collections/${collection_uuid}`, RequestBody("DELETE", null, null));
|
||||
const res = await errorHandling(result);
|
||||
return res;
|
||||
const result: any = await fetch(
|
||||
`${getAPIUrl()}collections/${collection_uuid}`,
|
||||
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, null));
|
||||
const res = await errorHandling(result);
|
||||
return res;
|
||||
const result: any = await fetch(
|
||||
`${getAPIUrl()}collections/`,
|
||||
RequestBody('POST', collection, null)
|
||||
)
|
||||
const res = await errorHandling(result)
|
||||
return res
|
||||
}
|
||||
|
||||
// Get a colletion by id
|
||||
export async function getCollectionById(collection_uuid: any) {
|
||||
const result: any = await fetch(`${getAPIUrl()}collections/${collection_uuid}`, { next: { revalidate: 10 } });
|
||||
const res = await errorHandling(result);
|
||||
return res;
|
||||
const result: any = await fetch(
|
||||
`${getAPIUrl()}collections/${collection_uuid}`,
|
||||
{ next: { revalidate: 10 } }
|
||||
)
|
||||
const res = await errorHandling(result)
|
||||
return res
|
||||
}
|
||||
|
||||
export async function getCollectionByIdWithAuthHeader(collection_uuid: any, access_token: string, next: any) {
|
||||
const result: any = await fetch(`${getAPIUrl()}collections/collection_${collection_uuid}`, RequestBodyWithAuthHeader("GET", null, next, access_token));
|
||||
const res = await errorHandling(result);
|
||||
return res;
|
||||
export async function getCollectionByIdWithAuthHeader(
|
||||
collection_uuid: any,
|
||||
access_token: string,
|
||||
next: any
|
||||
) {
|
||||
const result: any = await fetch(
|
||||
`${getAPIUrl()}collections/collection_${collection_uuid}`,
|
||||
RequestBodyWithAuthHeader('GET', null, next, access_token)
|
||||
)
|
||||
const res = await errorHandling(result)
|
||||
return res
|
||||
}
|
||||
|
||||
// Get collections
|
||||
// TODO : add per org filter
|
||||
export async function getOrgCollections() {
|
||||
const result: any = await fetch(`${getAPIUrl()}collections/page/1/limit/10`, { next: { revalidate: 10 } });
|
||||
const res = await errorHandling(result);
|
||||
return res;
|
||||
const result: any = await fetch(`${getAPIUrl()}collections/page/1/limit/10`, {
|
||||
next: { revalidate: 10 },
|
||||
})
|
||||
const res = await errorHandling(result)
|
||||
return res
|
||||
}
|
||||
|
||||
export async function getOrgCollectionsWithAuthHeader(org_id: string, access_token: string, next: any) {
|
||||
const result: any = await fetch(`${getAPIUrl()}collections/org/${org_id}/page/1/limit/10`, RequestBodyWithAuthHeader("GET", null, next, access_token));
|
||||
const res = await errorHandling(result);
|
||||
return res;
|
||||
export async function getOrgCollectionsWithAuthHeader(
|
||||
org_id: string,
|
||||
access_token: string,
|
||||
next: any
|
||||
) {
|
||||
const result: any = await fetch(
|
||||
`${getAPIUrl()}collections/org/${org_id}/page/1/limit/10`,
|
||||
RequestBodyWithAuthHeader('GET', null, next, access_token)
|
||||
)
|
||||
const res = await errorHandling(result)
|
||||
return res
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue