Set list in search box in settings

This commit is contained in:
Sytone 2021-06-08 08:24:11 -07:00
parent a9728f774d
commit 816c5bb4ec
5 changed files with 14 additions and 11 deletions

View File

@ -78,8 +78,8 @@ export default {
if (this.listId !== undefined) { if (this.listId !== undefined) {
this.listIdForNewTask = this.listId this.listIdForNewTask = this.listId
this.validListIdAvailable = true this.validListIdAvailable = true
} else if(this.$store.state.auth.settings.defaultListID !== undefined) { } else if(this.$store.state.auth.settings.defaultListId !== undefined) {
this.listIdForNewTask = this.$store.state.auth.settings.defaultListID this.listIdForNewTask = this.$store.state.auth.settings.defaultListId
this.validListIdAvailable = true this.validListIdAvailable = true
} }
}, },

View File

@ -42,8 +42,10 @@ export default {
}, },
}, },
beforeMount() { beforeMount() {
this.listSerivce = new ListService() this.listService = new ListService()
this.list = new ListModel() this.list = new ListModel()
},
mounted() {
if (this.listId !== undefined) { if (this.listId !== undefined) {
this.getListById() this.getListById()
} }
@ -55,9 +57,10 @@ export default {
return return
} }
this.listSerivce.getAll({}, {s: query}) this.listService.getAll({}, {s: query})
.then(response => { .then(response => {
this.$set(this, 'foundLists', response) this.$set(this, 'foundLists', response)
this.$set(this, 'list', response)
}) })
.catch(e => { .catch(e => {
this.error(e, this) this.error(e, this)
@ -66,7 +69,7 @@ export default {
getListById() { getListById() {
this.listService.get({id: this.listId}) this.listService.get({id: this.listId})
.then(response => { .then(response => {
this.$set(this, 'foundLists', response) this.list = response
}) })
.catch(e => { .catch(e => {
this.error(e, this) this.error(e, this)

View File

@ -9,7 +9,7 @@ export default class UserSettingsModel extends AbstractModel {
discoverableByName: false, discoverableByName: false,
discoverableByEmail: false, discoverableByEmail: false,
overdueTasksRemindersEnabled: true, overdueTasksRemindersEnabled: true,
defaultListID: 1, defaultListId: 1,
weekStart: 0, weekStart: 0,
} }
} }

View File

@ -3,9 +3,9 @@ import { ERROR_MESSAGE, LOADING } from '../mutation-types'
import UserModel from '../../models/user' import UserModel from '../../models/user'
const defaultSettings = settings => { const defaultSettings = settings => {
if (typeof settings.defaultListID === 'undefined' || settings.defaultListID === '') { // if (typeof settings.defaultListId === 'undefined' || settings.defaultListId === '') {
settings.defaultListID = 1 // settings.defaultListId = 1
} // }
if (typeof settings.weekStart === 'undefined' || settings.weekStart === '') { if (typeof settings.weekStart === 'undefined' || settings.weekStart === '') {
settings.weekStart = 0 settings.weekStart = 0
} }

View File

@ -138,7 +138,7 @@
Default list for new tasks is Default list for new tasks is
</span> </span>
<div class="ml-2"> <div class="ml-2">
<list-search @selected="changeList" :listId="settings.defaultListID" ref="defaultList"/> <list-search @selected="changeList" :listId="settings.defaultListId" ref="defaultList"/>
</div> </div>
</label> </label>
</div> </div>
@ -433,7 +433,7 @@ export default {
copy(text) copy(text)
}, },
changeList(list) { changeList(list) {
this.settings.defaultListID = list.id this.settings.defaultListId = list.id
}, },
}, },
} }