fix: actually deleting the list now works

This commit is contained in:
kolaente 2022-04-25 19:59:02 +02:00
parent 8578225982
commit b40d6f783c
Signed by untrusted user: konrad
GPG Key ID: F40E70337AB24C9B

View File

@ -12,7 +12,9 @@
<p> <p>
<strong v-if="totalTasks !== null" class="has-text-white"> <strong v-if="totalTasks !== null" class="has-text-white">
{{ totalTasks > 0 ? $t('list.delete.tasksToDelete', {count: totalTasks}) : $t('list.delete.noTasksToDelete') }} {{
totalTasks > 0 ? $t('list.delete.tasksToDelete', {count: totalTasks}) : $t('list.delete.noTasksToDelete')
}}
</strong> </strong>
<Loading v-else class="is-loading-small"/> <Loading v-else class="is-loading-small"/>
</p> </p>
@ -45,6 +47,10 @@ const list = computed(() => store.getters['lists/getListById'](route.params.list
watchEffect( watchEffect(
() => { () => {
if (!route.params.lisId) {
return
}
const taskCollectionService = new TaskCollectionService() const taskCollectionService = new TaskCollectionService()
taskCollectionService.getAll({listId: route.params.listId}).then(() => { taskCollectionService.getAll({listId: route.params.listId}).then(() => {
totalTasks.value = taskCollectionService.totalPages * taskCollectionService.resultCount totalTasks.value = taskCollectionService.totalPages * taskCollectionService.resultCount
@ -52,10 +58,10 @@ watchEffect(
}, },
) )
useTitle(() => t('list.delete.title', {list: list.value.title})) useTitle(() => t('list.delete.title', {list: list?.value?.title}))
async function deleteList() { async function deleteList() {
await store.dispatch('lists/deleteList', list) await store.dispatch('lists/deleteList', list.value)
success({message: t('list.delete.success')}) success({message: t('list.delete.success')})
router.push({name: 'home'}) router.push({name: 'home'})
} }