1
0
mirror of https://gitlab.com/bramw/baserow.git synced 2024-11-21 23:37:55 +00:00
bramw_baserow/web-frontend/modules/core/services/userFile.js
2022-12-06 15:08:34 +00:00

22 lines
531 B
JavaScript

export default (client) => {
return {
uploadFile(file, onUploadProgress = function () {}, cancelToken = null) {
const formData = new FormData()
formData.append('file', file)
const config = {
cancelToken,
onUploadProgress,
headers: {
'Content-Type': 'multipart/form-data',
},
}
return client.post('/user-files/upload-file/', formData, config)
},
uploadViaURL(url) {
return client.post('/user-files/upload-via-url/', { url })
},
}
}