/api/faxes endpoint was returning a 422 error
Uprocessable content. This commit
amends the payload to match what is in the
APIv1 documentation (old docs)
Change-Id: Ib8d9c0ec41e1e1a18bbe503db711b55e5f66e050
(cherry picked from commit 47d4627980
)
mr12.5
parent
bd913bfa9c
commit
c91d1bfc82
@ -1,17 +1,12 @@
|
|||||||
import { post } from 'src/api/common'
|
import { post } from 'src/api/common'
|
||||||
import _ from 'lodash'
|
|
||||||
|
|
||||||
export async function createFax (options) {
|
export async function createFax (options) {
|
||||||
const formData = new FormData()
|
if (options.faxfile === null) {
|
||||||
const fields = _.clone(options)
|
delete options.faxfile
|
||||||
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: formData
|
body: options
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in new issue