fix: getTaskById function

This commit is contained in:
Dominik Pschenitschni 2021-10-07 12:52:42 +02:00
parent 35c861b711
commit 9b2e9fc17f
No known key found for this signature in database
GPG key ID: B257AC0149F43A77

View file

@ -200,13 +200,13 @@ export default {
let taskIndex
const bucketIndex = state.buckets.findIndex(({ tasks }) => {
taskIndex = findIndexById(tasks, id)
return taskIndex !== undefined
return taskIndex !== -1
})
return {
bucketIndex: taskIndex || null,
taskIndex: taskIndex || null,
task: state.buckets?.[bucketIndex].tasks?.[taskIndex] || null,
bucketIndex: bucketIndex !== -1 ? bucketIndex : null,
taskIndex: taskIndex !== -1 ? taskIndex : null,
task: state.buckets[bucketIndex]?.tasks?.[taskIndex] || null,
}
}
},