2019-10-01 11:35:00 +00:00
|
|
|
const common = require('./common')
|
2019-02-22 14:53:43 +00:00
|
|
|
|
2019-10-01 17:18:20 +00:00
|
|
|
exports.uploadMedia = function(file, height) {
|
2019-02-22 14:53:43 +00:00
|
|
|
let formData = new FormData()
|
|
|
|
formData.append('file', file)
|
|
|
|
|
2019-10-01 17:18:20 +00:00
|
|
|
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',
|
2019-10-01 17:18:20 +00:00
|
|
|
url: '/api/media' + extra,
|
2019-09-13 13:33:10 +00:00
|
|
|
body: formData,
|
2019-02-22 14:53:43 +00:00
|
|
|
})
|
|
|
|
}
|