feat: improve types

This commit is contained in:
Dominik Pschenitschni 2022-10-09 13:57:45 +02:00
parent 1d495b8603
commit 6510ca4724
Signed by: dpschen
GPG Key ID: B257AC0149F43A77
1 changed files with 12 additions and 4 deletions

View File

@ -203,8 +203,12 @@ async function createTask(title: TaskModel['title']) {
return newTask return newTask
} }
async function updateTask(e) { async function updateTask(e: {
const task = tasks.value.get(e.bar.ganttBarConfig.id) bar: GanttBarObject;
e: MouseEvent;
datetime?: string | undefined;
}) {
const task = tasks.value.get(Number(e.bar.ganttBarConfig.id))
if (!task) return if (!task) return
@ -212,13 +216,17 @@ async function updateTask(e) {
task.endDate = e.bar.endDate task.endDate = e.bar.endDate
const updatedTask = await taskService.update(task) const updatedTask = await taskService.update(task)
ganttBars.value.map(gantBar => { ganttBars.value.map(gantBar => {
return gantBar[0].ganttBarConfig.id === task.id return Number(gantBar[0].ganttBarConfig.id) === task.id
? transformTaskToGanttBar(updatedTask) ? transformTaskToGanttBar(updatedTask)
: gantBar : gantBar
}) })
} }
function openTask(e) { function openTask(e: {
bar: GanttBarObject;
e: MouseEvent;
datetime?: string | undefined;
}) {
router.push({ router.push({
name: 'task.detail', name: 'task.detail',
params: {id: e.bar.ganttBarConfig.id}, params: {id: e.bar.ganttBarConfig.id},