chore(addTask) improve order (#1297)

Co-authored-by: Dominik Pschenitschni <mail@celement.de>
Reviewed-on: https://kolaente.dev/vikunja/frontend/pulls/1297
Reviewed-by: konrad <k@knt.li>
Co-authored-by: Dominik Pschenitschni <dpschen@noreply.kolaente.de>
Co-committed-by: Dominik Pschenitschni <dpschen@noreply.kolaente.de>
This commit is contained in:
Dominik Pschenitschni 2022-01-05 13:14:50 +00:00 committed by konrad
parent c618b7e0b6
commit e28f0f5be4

View file

@ -42,7 +42,7 @@ import {useI18n} from 'vue-i18n'
import {useStore} from 'vuex' import {useStore} from 'vuex'
import { tryOnMounted, debouncedWatch, useWindowSize, MaybeRef } from '@vueuse/core' import { tryOnMounted, debouncedWatch, useWindowSize, MaybeRef } from '@vueuse/core'
import TaskService from '../../services/task' import TaskService from '@/services/task'
import QuickAddMagic from '@/components/tasks/partials/quick-add-magic.vue' import QuickAddMagic from '@/components/tasks/partials/quick-add-magic.vue'
function cleanupTitle(title: string) { function cleanupTitle(title: string) {
@ -117,9 +117,6 @@ function useAutoHeightTextarea(value: MaybeRef<string>) {
return textarea return textarea
} }
const emit = defineEmits(['taskAdded'])
const props = defineProps({ const props = defineProps({
defaultPosition: { defaultPosition: {
type: Number, type: Number,
@ -127,8 +124,7 @@ const props = defineProps({
}, },
}) })
const taskService = shallowReactive(new TaskService()) const emit = defineEmits(['taskAdded'])
const errorMessage = ref('')
const newTaskTitle = ref('') const newTaskTitle = ref('')
const newTaskInput = useAutoHeightTextarea(newTaskTitle) const newTaskInput = useAutoHeightTextarea(newTaskTitle)
@ -136,6 +132,9 @@ const newTaskInput = useAutoHeightTextarea(newTaskTitle)
const { t } = useI18n() const { t } = useI18n()
const store = useStore() const store = useStore()
const taskService = shallowReactive(new TaskService())
const errorMessage = ref('')
async function addTask() { async function addTask() {
if (newTaskTitle.value === '') { if (newTaskTitle.value === '') {
errorMessage.value = t('list.create.addTitleRequired') errorMessage.value = t('list.create.addTitleRequired')