feat: create task when pressing the button
This commit is contained in:
parent
7d61635182
commit
3a32501064
1 changed files with 4 additions and 2 deletions
|
@ -46,7 +46,7 @@
|
||||||
v-model="newTaskTitle"
|
v-model="newTaskTitle"
|
||||||
/>
|
/>
|
||||||
</transition>
|
</transition>
|
||||||
<x-button @click="showCreateNewTask" :shadow="false" icon="plus">
|
<x-button @click="showCreateTaskOrCreate" :shadow="false" icon="plus">
|
||||||
{{ $t('task.new') }}
|
{{ $t('task.new') }}
|
||||||
</x-button>
|
</x-button>
|
||||||
</form>
|
</form>
|
||||||
|
@ -195,13 +195,15 @@ const newTaskFieldActive = ref(false)
|
||||||
const newTaskTitleField = ref()
|
const newTaskTitleField = ref()
|
||||||
const newTaskTitle = ref('')
|
const newTaskTitle = ref('')
|
||||||
|
|
||||||
function showCreateNewTask() {
|
function showCreateTaskOrCreate() {
|
||||||
if (!newTaskFieldActive.value) {
|
if (!newTaskFieldActive.value) {
|
||||||
// Timeout to not send the form if the field isn't even shown
|
// Timeout to not send the form if the field isn't even shown
|
||||||
setTimeout(() => {
|
setTimeout(() => {
|
||||||
newTaskFieldActive.value = true
|
newTaskFieldActive.value = true
|
||||||
nextTick(() => newTaskTitleField.value.focus())
|
nextTick(() => newTaskTitleField.value.focus())
|
||||||
}, 100)
|
}, 100)
|
||||||
|
} else {
|
||||||
|
createTask()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue