feat: create task when pressing the button

This commit is contained in:
kolaente 2022-07-21 16:17:24 +02:00
parent 091beecc19
commit 0a9588e097
Signed by: konrad
GPG Key ID: F40E70337AB24C9B
1 changed files with 4 additions and 2 deletions

View File

@ -46,7 +46,7 @@
v-model="newTaskTitle"
/>
</transition>
<x-button @click="showCreateNewTask" :shadow="false" icon="plus">
<x-button @click="showCreateTaskOrCreate" :shadow="false" icon="plus">
{{ $t('task.new') }}
</x-button>
</form>
@ -195,13 +195,15 @@ const newTaskFieldActive = ref(false)
const newTaskTitleField = ref()
const newTaskTitle = ref('')
function showCreateNewTask() {
function showCreateTaskOrCreate() {
if (!newTaskFieldActive.value) {
// Timeout to not send the form if the field isn't even shown
setTimeout(() => {
newTaskFieldActive.value = true
nextTick(() => newTaskTitleField.value.focus())
}, 100)
} else {
createTask()
}
}