Skip to content
Snippets Groups Projects
Commit 7d3a6e77 authored by Alexander Gitter's avatar Alexander Gitter
Browse files

Show spinner while uploading file

parent d6cc55ca
No related branches found
No related tags found
No related merge requests found
......@@ -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
}
}
}
......
<template>
<div class="media-upload">
<label class="btn btn-default">
<i class="fa icon-upload"></i>
<i class="fa icon-spin4 animate-spin" v-if="uploading"></i>
<i class="fa icon-upload" v-if="!uploading"></i>
<input type=file style="position: fixed; top: -100em"></input>
</label>
</div>
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment