chore: trigger success message from store
Some checks failed
continuous-integration/drone/pr Build is failing
Some checks failed
continuous-integration/drone/pr Build is failing
This commit is contained in:
parent
a865dcc202
commit
47d6751a56
|
@ -5,6 +5,8 @@ import UserModel from '@/models/user'
|
|||
import UserSettingsService from '@/services/userSettings'
|
||||
import {getToken, refreshToken, removeToken, saveToken} from '@/helpers/auth'
|
||||
import {setLoading} from '@/store/helper'
|
||||
import {i18n} from '@/i18n'
|
||||
import {success} from '@/message'
|
||||
|
||||
const AUTH_TYPES = {
|
||||
'UNKNOWN': 0,
|
||||
|
@ -227,8 +229,10 @@ export default {
|
|||
if (typeof info.settings.language !== 'undefined') {
|
||||
// save current language
|
||||
await dispatch('saveUserSettings', {
|
||||
...state.settings,
|
||||
language: getCurrentLanguage(),
|
||||
settings: {
|
||||
...state.settings,
|
||||
language: getCurrentLanguage(),
|
||||
},
|
||||
})
|
||||
}
|
||||
|
||||
|
@ -238,7 +242,7 @@ export default {
|
|||
}
|
||||
},
|
||||
|
||||
async saveUserSettings(ctx, settings) {
|
||||
async saveUserSettings(ctx, {settings, showMessage}) {
|
||||
const userSettingsService = new UserSettingsService()
|
||||
|
||||
const cancel = setLoading(ctx, 'general-settings')
|
||||
|
@ -246,6 +250,9 @@ export default {
|
|||
saveLanguage(settings.language)
|
||||
await userSettingsService.update(settings)
|
||||
ctx.commit('setUserSettings', {...settings})
|
||||
if (showMessage) {
|
||||
success({message: i18n.global.t('user.settings.general.savedSuccess')})
|
||||
}
|
||||
} catch (e) {
|
||||
throw new Error('Error while saving user settings:', {cause: e})
|
||||
} finally {
|
||||
|
|
|
@ -168,8 +168,8 @@ export default {
|
|||
settings: {...this.$store.state.auth.settings},
|
||||
id: createRandomID(),
|
||||
availableLanguageOptions: Object.entries(availableLanguages)
|
||||
.map(l => ({code: l[0], title: l[1]}))
|
||||
.sort((a, b) => a.title.localeCompare(b.title)),
|
||||
.map(l => ({code: l[0], title: l[1]}))
|
||||
.sort((a, b) => a.title.localeCompare(b.title)),
|
||||
}
|
||||
},
|
||||
components: {
|
||||
|
@ -210,8 +210,10 @@ export default {
|
|||
localStorage.setItem(playSoundWhenDoneKey, this.playSoundWhenDone)
|
||||
setQuickAddMagicMode(this.quickAddMagicMode)
|
||||
|
||||
await this.$store.dispatch('auth/saveUserSettings', {...this.settings})
|
||||
this.$message.success({message: this.$t('user.settings.general.savedSuccess')})
|
||||
await this.$store.dispatch('auth/saveUserSettings', {
|
||||
settings: {...this.settings},
|
||||
showMessage: true,
|
||||
})
|
||||
},
|
||||
},
|
||||
}
|
||||
|
|
Reference in New Issue
Block a user