From 852095f5cf6b050f6d4d1e30edd191d07dd392ad Mon Sep 17 00:00:00 2001 From: xmflsct Date: Wed, 21 Dec 2022 14:38:09 +0100 Subject: [PATCH] Fix #597 --- src/api/general.ts | 2 +- src/api/instance.ts | 2 +- src/api/tooot.ts | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/src/api/general.ts b/src/api/general.ts index f13e698f..79340041 100644 --- a/src/api/general.ts +++ b/src/api/general.ts @@ -44,7 +44,7 @@ const apiGeneral = async ({ ...userAgent, ...headers }, - ...(body && { data: body }) + ...((body as (FormData & { _parts: [][] }) | undefined)?._parts.length && { data: body }) }) .then(response => { let links: { diff --git a/src/api/instance.ts b/src/api/instance.ts index d6446e8f..71cfa348 100644 --- a/src/api/instance.ts +++ b/src/api/instance.ts @@ -64,7 +64,7 @@ const apiInstance = async ({ Authorization: `Bearer ${token}` }) }, - ...(body && { data: body }), + ...((body as (FormData & { _parts: [][] }) | undefined)?._parts.length && { data: body }), ...extras }) .then(response => { diff --git a/src/api/tooot.ts b/src/api/tooot.ts index 0ebb5b57..3b2a8fa5 100644 --- a/src/api/tooot.ts +++ b/src/api/tooot.ts @@ -47,7 +47,7 @@ const apiTooot = async ({ ...userAgent, ...headers }, - ...(body && { data: body }) + ...((body as (FormData & { _parts: [][] }) | undefined)?._parts.length && { data: body }) }) .then(response => { return Promise.resolve({