fix user background upload fail + display them
This commit is contained in:
parent
e9b125a6a1
commit
7e2dd215e4
3 changed files with 38 additions and 1 deletions
|
|
@ -67,6 +67,7 @@ const AppearanceTab = {
|
|||
})),
|
||||
backgroundUploading: false,
|
||||
background: null,
|
||||
backgroundError: null,
|
||||
backgroundPreview: null,
|
||||
}
|
||||
},
|
||||
|
|
@ -474,6 +475,9 @@ const AppearanceTab = {
|
|||
resetUploadedBackground() {
|
||||
this.backgroundPreview = null
|
||||
},
|
||||
clearBackgroundError() {
|
||||
this.backgroundError = null
|
||||
},
|
||||
submitBackground(background) {
|
||||
if (!this.backgroundPreview && background !== '') {
|
||||
return
|
||||
|
|
@ -486,8 +490,11 @@ const AppearanceTab = {
|
|||
this.$store.commit('addNewUsers', [data])
|
||||
this.$store.commit('setCurrentUser', data)
|
||||
this.backgroundPreview = null
|
||||
this.backgroundError = null
|
||||
})
|
||||
.catch((e) => {
|
||||
this.backgroundError = e
|
||||
})
|
||||
.catch(this.displayUploadError)
|
||||
.finally(() => {
|
||||
this.backgroundUploading = false
|
||||
})
|
||||
|
|
|
|||
|
|
@ -208,6 +208,23 @@
|
|||
{{ $t('settings.reset') }}
|
||||
</button>
|
||||
</div>
|
||||
<div
|
||||
v-if="backgroundError"
|
||||
class="alert error -dismissible"
|
||||
>
|
||||
<span>
|
||||
{{ backgroundError }}
|
||||
</span>
|
||||
<button
|
||||
class="button-unstyled"
|
||||
@click="clearBackgroundError"
|
||||
>
|
||||
<FAIcon
|
||||
class="fa-scale-110 fa-old-padding"
|
||||
icon="times"
|
||||
/>
|
||||
</button>
|
||||
</div>
|
||||
<button
|
||||
v-if="!isDefaultBackground"
|
||||
class="btn button-default reset-button"
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue