pinafore/routes/_api/media.js
2018-03-02 17:54:38 -08:00

10 lines
339 B
JavaScript

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))
}