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

Revert original code and just add missing
header.

Change-Id: If109b4ecc3810aad7cae5b8dc1b0dd87a7d6e325
(cherry picked from commit 3daeb267bb)
mr13.2
Debora Crescenzo 3 months ago committed by Crescenzo Debora
parent 9d6483bad6
commit 7391ca76a0

@ -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