1
0

fix: saving default list (#1143)

Co-authored-by: kolaente <k@knt.li>
Reviewed-on: https://kolaente.dev/vikunja/frontend/pulls/1143
Reviewed-by: Dominik Pschenitschni <dpschen@noreply.kolaente.de>
Co-authored-by: konrad <k@knt.li>
Co-committed-by: konrad <k@knt.li>
This commit is contained in:
konrad
2021-12-13 22:20:45 +00:00
parent 40479d0c6e
commit 543dae2f30
4 changed files with 62 additions and 58 deletions

View File

@ -238,7 +238,7 @@
</h3>
<div class="field has-addons">
<div class="control is-expanded">
<list-search @selected="changeList" ref="moveList"/>
<list-search @update:modelValue="changeList" ref="moveList"/>
</div>
</div>
</div>

View File

@ -131,8 +131,10 @@ import {playPop} from '@/helpers/playPop'
import {useColorScheme} from '@/composables/useColorScheme'
import {success} from '@/message'
const DEFAULT_LIST_ID = 0
function useColorSchemeSetting() {
const { t } = useI18n()
const {t} = useI18n()
const colorSchemeSettings = computed(() => ({
light: t('user.settings.appearance.colorScheme.light'),
auto: t('user.settings.appearance.colorScheme.system'),
@ -141,9 +143,11 @@ function useColorSchemeSetting() {
const {store} = useColorScheme()
watch(store, (schemeId) => {
success({message: t('user.settings.appearance.setSuccess', {
colorScheme: colorSchemeSettings.value[schemeId],
})})
success({
message: t('user.settings.appearance.setSuccess', {
colorScheme: colorSchemeSettings.value[schemeId],
}),
})
})
return {
@ -178,8 +182,13 @@ export default {
.map(l => ({code: l[0], title: l[1]}))
.sort((a, b) => a.title.localeCompare(b.title))
},
defaultList() {
return this.$store.getters['lists/getListById'](this.settings.defaultListId)
defaultList: {
get() {
return this.$store.getters['lists/getListById'](this.settings.defaultListId)
},
set(l) {
this.settings.defaultListId = l ? l.id : DEFAULT_LIST_ID
},
},
},
@ -204,12 +213,13 @@ export default {
localStorage.setItem(playSoundWhenDoneKey, this.playSoundWhenDone)
saveLanguage(this.language)
setQuickAddMagicMode(this.quickAddMagicMode)
this.settings.defaultListId = this.defaultList ? this.defaultList.id : 0
await this.userSettingsService.update(this.settings)
this.$store.commit('auth/setUserSettings', {
const settings = {
...this.settings,
})
}
await this.userSettingsService.update(settings)
this.$store.commit('auth/setUserSettings', settings)
this.$message.success({message: this.$t('user.settings.general.savedSuccess')})
},
},