Show spinner while uploading file

This commit is contained in:
Alexander Gitter 2016-11-13 18:26:10 +01:00
parent d6cc55ca8c
commit 7d3a6e77e4
2 changed files with 15 additions and 1 deletions

View file

@ -11,11 +11,24 @@ const mediaUpload = {
const file = target.files[0]
const formData = new FormData()
formData.append('media', file)
self.$emit('uploading')
self.uploading = true
statusPosterService.uploadMedia({ store, formData })
.then((fileData) => {
self.$emit('uploaded', fileData)
self.uploading = false
}, (error) => {
self.$emit('upload-failed')
self.uploading = false
})
})
},
data () {
return {
uploading: false
}
}
}