pinafore/routes/_api/media.js

9 lines
338 B
JavaScript
Raw Normal View History

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