chore: fixed toast from services

This commit is contained in:
jey-exp 2025-03-06 00:18:29 +05:30
parent bb1ac403f1
commit b751ade3d8

View file

@ -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:})
} }
} }