Add media upload to StatusPosterService.

This commit is contained in:
Roger Braun 2016-11-06 19:30:20 +01:00
parent f86f0ef7f0
commit 7e2e2d3ec3
1 changed files with 14 additions and 1 deletions

View File

@ -12,8 +12,21 @@ const postStatus = ({ store, status, media = [], inReplyToStatusId = undefined }
})
}
const uploadMedia = ({ store, formData }) => {
const credentials = store.state.users.currentUser.credentials
return apiService.uploadMedia({ credentials, formData }).then((xml) => {
return {
id: xml.getElementsByTagName('media_id')[0].textContent,
url: xml.getElementsByTagName('media_url')[0].textContent,
image: xml.getElementsByTagName('atom:link')[0].getAttribute('href')
}
})
}
const statusPosterService = {
postStatus
postStatus,
uploadMedia
}
export default statusPosterService