mirror of
https://github.com/rzmk/learnhouse.git
synced 2025-12-19 04:19:25 +00:00
chore: fixed toast from services
This commit is contained in:
parent
bb1ac403f1
commit
b751ade3d8
1 changed files with 6 additions and 6 deletions
|
|
@ -14,33 +14,33 @@ export async function deleteCollection(
|
||||||
collection_uuid: any,
|
collection_uuid: any,
|
||||||
access_token: any
|
access_token: any
|
||||||
) {
|
) {
|
||||||
const toastId = toast.loading("Deleting collection...")
|
const = toast.loading("Deleting collection...")
|
||||||
try {
|
try {
|
||||||
const result: any = await fetch(
|
const result: any = await fetch(
|
||||||
`${getAPIUrl()}collections/${collection_uuid}`,
|
`${getAPIUrl()}collections/${collection_uuid}`,
|
||||||
RequestBodyWithAuthHeader('DELETE', null, null, access_token)
|
RequestBodyWithAuthHeader('DELETE', null, null, access_token)
|
||||||
)
|
)
|
||||||
toast.success("Deleted colletion", {id:toastId})
|
toast.success("Deleted colletion", {id:})
|
||||||
const res = await errorHandling(result)
|
const res = await errorHandling(result)
|
||||||
return res
|
return res
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
toast.error("Couldn't delete collection", {id:toastId})
|
toast.error("Couldn't delete collection", {id:})
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// Create a new collection
|
// Create a new collection
|
||||||
export async function createCollection(collection: any, access_token: any) {
|
export async function createCollection(collection: any, access_token: any) {
|
||||||
const toastId = toast.loading("Creating...")
|
const = toast.loading("Creating...")
|
||||||
try {
|
try {
|
||||||
const result: any = await fetch(
|
const result: any = await fetch(
|
||||||
`${getAPIUrl()}collections/`,
|
`${getAPIUrl()}collections/`,
|
||||||
RequestBodyWithAuthHeader('POST', collection, null, access_token)
|
RequestBodyWithAuthHeader('POST', collection, null, access_token)
|
||||||
)
|
)
|
||||||
toast.success("New collection created", {id:toastId})
|
toast.success("New collection created", {id:})
|
||||||
const res = await errorHandling(result)
|
const res = await errorHandling(result)
|
||||||
return res
|
return res
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
toast.error("Couldn't create collection", {id:toastId})
|
toast.error("Couldn't create collection", {id:})
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue