Properly handle pictrs delete image response

This commit is contained in:
Felix Ableitner 2023-11-15 11:37:34 +01:00
parent 73e172cb2d
commit 18bc0bcb5d

View file

@ -1409,7 +1409,7 @@ export class LemmyHttp {
/** /**
* Delete a pictrs image * Delete a pictrs image
*/ */
async deleteImage({ token, filename }: DeleteImage): Promise<any> { async deleteImage({ token, filename }: DeleteImage): Promise<boolean> {
const deleteUrl = `${this.#pictrsUrl}/delete/${token}/${filename}`; const deleteUrl = `${this.#pictrsUrl}/delete/${token}/${filename}`;
const response = await this.#fetchFunction(deleteUrl, { const response = await this.#fetchFunction(deleteUrl, {
@ -1417,7 +1417,7 @@ export class LemmyHttp {
headers: this.#headers, headers: this.#headers,
}); });
return await response.json(); return (await response.status) == 204;
} }
#buildFullUrl(endpoint: string) { #buildFullUrl(endpoint: string) {