mirror of
https://github.com/rzmk/learnhouse.git
synced 2025-12-18 20:09:25 +00:00
chore fix
This commit is contained in:
parent
b751ade3d8
commit
bc3a20e1f6
2 changed files with 12 additions and 25 deletions
|
|
@ -14,34 +14,22 @@ export async function deleteCollection(
|
|||
collection_uuid: any,
|
||||
access_token: any
|
||||
) {
|
||||
const = toast.loading("Deleting collection...")
|
||||
try {
|
||||
const result: any = await fetch(
|
||||
`${getAPIUrl()}collections/${collection_uuid}`,
|
||||
RequestBodyWithAuthHeader('DELETE', null, null, access_token)
|
||||
)
|
||||
toast.success("Deleted colletion", {id:})
|
||||
const res = await errorHandling(result)
|
||||
return res
|
||||
} catch (error) {
|
||||
toast.error("Couldn't delete collection", {id:})
|
||||
}
|
||||
const result: any = await fetch(
|
||||
`${getAPIUrl()}collections/${collection_uuid}`,
|
||||
RequestBodyWithAuthHeader('DELETE', null, null, access_token)
|
||||
)
|
||||
const res = await errorHandling(result)
|
||||
return res
|
||||
}
|
||||
|
||||
// Create a new collection
|
||||
export async function createCollection(collection: any, access_token: any) {
|
||||
const = toast.loading("Creating...")
|
||||
try {
|
||||
const result: any = await fetch(
|
||||
`${getAPIUrl()}collections/`,
|
||||
RequestBodyWithAuthHeader('POST', collection, null, access_token)
|
||||
)
|
||||
toast.success("New collection created", {id:})
|
||||
const res = await errorHandling(result)
|
||||
return res
|
||||
} catch (error) {
|
||||
toast.error("Couldn't create collection", {id:})
|
||||
}
|
||||
const result: any = await fetch(
|
||||
`${getAPIUrl()}collections/`,
|
||||
RequestBodyWithAuthHeader('POST', collection, null, access_token)
|
||||
)
|
||||
const res = await errorHandling(result)
|
||||
return res
|
||||
}
|
||||
|
||||
export async function getCollectionById(
|
||||
|
|
|
|||
|
|
@ -4,7 +4,6 @@ import {
|
|||
errorHandling,
|
||||
getResponseMetadata,
|
||||
} from '@services/utils/ts/requests'
|
||||
import toast from 'react-hot-toast'
|
||||
|
||||
/*
|
||||
This file includes only POST, PUT, DELETE requests
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue