feat: handling image delete
This commit is contained in:
@@ -18,7 +18,7 @@ import {
|
||||
type BaseRequestParams = Partial<{
|
||||
path: string;
|
||||
body: RequestInit["body"];
|
||||
method: "GET" | "POST";
|
||||
method: "GET" | "POST" | "DELETE";
|
||||
}>;
|
||||
|
||||
// export const base = "https://haystack.johncosta.tech";
|
||||
@@ -68,6 +68,17 @@ export const sendImageFile = async (
|
||||
return parse(sendImageResponseValidator, res);
|
||||
};
|
||||
|
||||
export const deleteImage = async (
|
||||
imageID: string
|
||||
): Promise<void> => {
|
||||
const request = getBaseAuthorizedRequest({
|
||||
path: `images/${imageID}`,
|
||||
method: "DELETE",
|
||||
});
|
||||
|
||||
await fetch(request);
|
||||
}
|
||||
|
||||
export class ImageLimitReached extends Error {
|
||||
constructor() {
|
||||
super();
|
||||
|
||||
Reference in New Issue
Block a user