mirror of
https://akkoma.dev/AkkomaGang/akkoma-fe.git
synced 2024-11-08 17:39:09 +00:00
Show spinner while uploading file
This commit is contained in:
parent
d6cc55ca8c
commit
7d3a6e77e4
2 changed files with 15 additions and 1 deletions
|
@ -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
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -1,7 +1,8 @@
|
|||
<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>
|
||||
|
|
Loading…
Reference in a new issue