Revert original code and just add missing header. Change-Id: If109b4ecc3810aad7cae5b8dc1b0dd87a7d6e325 (cherry picked from commitmr13.0.13daeb267bb
) (cherry picked from commit9fd654638a
)
parent
166e19ad94
commit
5def8058cd
@ -1,12 +1,18 @@
|
|||||||
|
import _ from 'lodash'
|
||||||
import { post } from 'src/api/common'
|
import { post } from 'src/api/common'
|
||||||
|
|
||||||
export async function createFax (options) {
|
export async function createFax (options) {
|
||||||
if (options.faxfile === null) {
|
const formData = new FormData()
|
||||||
delete options.faxfile
|
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({
|
return await post({
|
||||||
resource: 'faxes',
|
resource: 'faxes',
|
||||||
body: options
|
headers: { 'Content-Type': 'multipart/form-data' },
|
||||||
|
body: formData
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in new issue