nfp_sites/app/api/media.js

18 lines
326 B
JavaScript
Raw Normal View History

2019-10-01 11:35:00 +00:00
const common = require('./common')
2019-02-22 14:53:43 +00:00
exports.uploadMedia = function(file, height) {
2019-02-22 14:53:43 +00:00
let formData = new FormData()
formData.append('file', file)
let extra = ''
if (height) {
extra = '?height=' + height
}
2019-10-01 11:35:00 +00:00
return common.sendRequest({
2019-02-22 14:53:43 +00:00
method: 'POST',
url: '/api/media' + extra,
2019-09-13 13:33:10 +00:00
body: formData,
2019-02-22 14:53:43 +00:00
})
}