fix: hide "title required" error after entering text

This commit is contained in:
kolaente 2022-02-26 13:05:39 +01:00
parent 1256c37b69
commit 45c05296a6
No known key found for this signature in database
GPG key ID: F40E70337AB24C9B

View file

@ -10,7 +10,7 @@
v-focus v-focus
v-model="newTaskTitle" v-model="newTaskTitle"
ref="newTaskInput" ref="newTaskInput"
@keyup="errorMessage = ''" @keyup="resetEmptyTitleError"
@keydown.enter="handleEnter" @keydown.enter="handleEnter"
/> />
<span class="icon is-small is-left"> <span class="icon is-small is-left">
@ -135,6 +135,12 @@ const store = useStore()
const taskService = shallowReactive(new TaskService()) const taskService = shallowReactive(new TaskService())
const errorMessage = ref('') const errorMessage = ref('')
function resetEmptyTitleError() {
if(newTaskTitle.value !== '') {
errorMessage.value = ''
}
}
async function addTask() { async function addTask() {
if (newTaskTitle.value === '') { if (newTaskTitle.value === '') {
errorMessage.value = t('list.create.addTitleRequired') errorMessage.value = t('list.create.addTitleRequired')