1
0
mirror of https://github.com/tooot-app/app synced 2024-12-24 16:41:31 +01:00

Another fix #597

This commit is contained in:
xmflsct 2022-12-21 15:21:35 +01:00
parent b36863337e
commit a0bfb6cb24
2 changed files with 8 additions and 2 deletions

View File

@ -44,7 +44,10 @@ const apiGeneral = async <T = unknown>({
...userAgent, ...userAgent,
...headers ...headers
}, },
...((body as (FormData & { _parts: [][] }) | undefined)?._parts.length && { data: body }) ...(body &&
(body instanceof FormData
? (body as (FormData & { _parts: [][] }) | undefined)?._parts?.length
: Object.keys(body).length) && { data: body })
}) })
.then(response => { .then(response => {
let links: { let links: {

View File

@ -47,7 +47,10 @@ const apiTooot = async <T = unknown>({
...userAgent, ...userAgent,
...headers ...headers
}, },
...((body as (FormData & { _parts: [][] }) | undefined)?._parts.length && { data: body }) ...(body &&
(body instanceof FormData
? (body as (FormData & { _parts: [][] }) | undefined)?._parts?.length
: Object.keys(body).length) && { data: body })
}) })
.then(response => { .then(response => {
return Promise.resolve({ return Promise.resolve({