chatengine-io / react-chat-engine

React component for a cheap and easy chat API
137 stars 35 forks source link

Can't update avatar when sending formData #169

Open sbkobaidze opened 1 year ago

sbkobaidze commented 1 year ago

Here's how I generate blob using url async function getFile(url:string) { let response = await fetch(url); let data = await response.blob(); return new File([data], "test.png", { type: 'image/png' }); } Here's the formdata ` const form = new FormData(

)
form.append('avatar', file,'test.png')
form.append('username',userData.username)
form.append('secret', '123')`

here's the request to update avatar const updateUser = await fetch(https://api.chatengine.io/users/`, { method: "POST", headers: { "PRIVATE-KEY": process.env.CHAT_SECRET!,

    },
    body:form

})

`

It says that user already exists

sbkobaidze commented 1 year ago

I tried using Patch Method by passing userId in the request endpoint and now I'm getting this error - { detail: 'Multipart form parse error - Invalid boundary in multipart: None' }

maxivalli commented 9 months ago

Hi, can you solved it?