#371: show notification when user setting's saved

This commit is contained in:
dave 2019-02-19 12:38:49 -05:00
parent 962a33f887
commit 63cfe051c7
3 changed files with 19 additions and 3 deletions

View file

@ -60,6 +60,9 @@ const UserSettings = {
private: { selected: this.newDefaultScope === 'private' }, private: { selected: this.newDefaultScope === 'private' },
direct: { selected: this.newDefaultScope === 'direct' } direct: { selected: this.newDefaultScope === 'direct' }
} }
},
currentSaveStateNotice () {
return this.$store.state.interface.settings.currentSaveStateNotice
} }
}, },
methods: { methods: {

View file

@ -1,7 +1,20 @@
<template> <template>
<div class="settings panel panel-default"> <div class="settings panel panel-default">
<div class="panel-heading"> <div class="panel-heading">
{{$t('settings.user_settings')}} <div class="title">
{{$t('settings.user_settings')}}
</div>
<transition name="fade">
<template v-if="currentSaveStateNotice">
<div @click.prevent class="alert error" v-if="currentSaveStateNotice.error">
{{ $t('settings.saving_err') }}
</div>
<div @click.prevent class="alert transparent" v-if="!currentSaveStateNotice.error">
{{ $t('settings.saving_ok') }}
</div>
</template>
</transition>
</div> </div>
<div class="panel-body profile-edit"> <div class="panel-body profile-edit">
<tab-switcher> <tab-switcher>

View file

@ -84,12 +84,12 @@ export default function createPersistedState ({
setState(key, reducer(state, paths), storage) setState(key, reducer(state, paths), storage)
.then(success => { .then(success => {
if (typeof success !== 'undefined') { if (typeof success !== 'undefined') {
if (mutation.type === 'setOption') { if (mutation.type === 'setOption' || mutation.type === 'setCurrentUser') {
store.dispatch('settingsSaved', { success }) store.dispatch('settingsSaved', { success })
} }
} }
}, error => { }, error => {
if (mutation.type === 'setOption') { if (mutation.type === 'setOption' || mutation.type === 'setCurrentUser') {
store.dispatch('settingsSaved', { error }) store.dispatch('settingsSaved', { error })
} }
}) })