2018-03-02 06:21:49 +01:00
|
|
|
import { auth, basename } from './utils'
|
|
|
|
import { postWithTimeout } from '../_utils/ajax'
|
|
|
|
|
2018-03-06 07:36:54 +01:00
|
|
|
export async function uploadMedia (instanceName, accessToken, file, description) {
|
2018-03-02 06:21:49 +01:00
|
|
|
let formData = new FormData()
|
|
|
|
formData.append('file', file)
|
2018-03-06 07:36:54 +01:00
|
|
|
formData.append('description', description)
|
2018-03-02 06:21:49 +01:00
|
|
|
let url = `${basename(instanceName)}/api/v1/media`
|
|
|
|
return postWithTimeout(url, formData, auth(accessToken))
|
2018-03-03 02:54:38 +01:00
|
|
|
}
|