MT#62025 Add multipart/form-data to api/faxes req

Revert original code and just add missing
header.

Change-Id: If109b4ecc3810aad7cae5b8dc1b0dd87a7d6e325
master
Debora Crescenzo 3 months ago
parent b0ba5c9b58
commit 3daeb267bb

@ -1,12 +1,18 @@
import _ from 'lodash'
import { post } from 'src/api/common'
export async function createFax (options) {
if (options.faxfile === null) {
delete options.faxfile
const formData = new FormData()
const fields = _.clone(options)
delete fields.faxfile
const json = JSON.stringify(fields)
formData.append('json', json)
if (options.faxfile) {
formData.append('faxfile', options.faxfile)
}
return await post({
resource: 'faxes',
body: options
headers: { 'Content-Type': 'multipart/form-data' },
body: formData
})
}

Loading…
Cancel
Save