Actually use the list when creating a new task

This commit is contained in:
kolaente 2021-07-17 21:22:43 +02:00
parent 7b8fbe1835
commit 0e02b38c1e
Signed by untrusted user: konrad
GPG Key ID: F40E70337AB24C9B

View File

@ -1,5 +1,5 @@
<template> <template>
<div> <div v-if="listIdToUse !== null">
<div class="field is-grouped"> <div class="field is-grouped">
<p :class="{ 'is-loading': taskService.loading}" class="control has-icons-left is-expanded"> <p :class="{ 'is-loading': taskService.loading}" class="control has-icons-left is-expanded">
<input <input
@ -83,8 +83,7 @@ export default {
taskService: TaskService, taskService: TaskService,
labelService: LabelService, labelService: LabelService,
labelTaskService: LabelTaskService, labelTaskService: LabelTaskService,
listIdForNewTask: null, listIdToUse: null,
validListIdAvailable: false,
showError: false, showError: false,
} }
}, },
@ -110,11 +109,9 @@ export default {
// If the parent provides the ID alway use that be falling back to the one // If the parent provides the ID alway use that be falling back to the one
// stored in settings. If neither are avliable then hide the component. // stored in settings. If neither are avliable then hide the component.
if (this.listId !== undefined) { if (this.listId !== undefined) {
this.listIdForNewTask = this.listId this.listIdToUse = this.listId
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.listIdToUse = this.$store.state.auth.settings.defaultListId
this.validListIdAvailable = true
} }
}, },
methods: { methods: {
@ -125,7 +122,7 @@ export default {
} }
this.showError = false this.showError = false
this.createNewTask(this.newTaskText) this.createNewTask(this.newTaskText, 0, this.listIdToUse)
.then(task => { .then(task => {
this.newTaskText = '' this.newTaskText = ''
this.$emit('taskAdded', task) this.$emit('taskAdded', task)