* fix: multipart form data sorting place all the file types in multipart form data body in the last to avoid errors due to map key being placed after file type data * refactor: fp-ify formdata file sort implementation Co-authored-by: Liyas Thomas <liyascthomas@gmail.com> Co-authored-by: Andrew Bastin <andrewbastin.k@gmail.com>
13 lines
242 B
TypeScript
13 lines
242 B
TypeScript
type FormDataEntry = {
|
|
key: string
|
|
value: string | Blob
|
|
}
|
|
|
|
export const toFormData = (values: FormDataEntry[]) => {
|
|
const formData = new FormData()
|
|
|
|
values.forEach(({ key, value }) => formData.append(key, value))
|
|
|
|
return formData
|
|
}
|