Properly handle pictrs delete image response (#214)

This commit is contained in:
Nutomic 2023-11-15 14:37:40 +01:00 committed by GitHub
parent 73e172cb2d
commit 8f4860c01b
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

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) {