diff --git a/client/src/components/ui/ConfirmDialog.vue b/client/src/components/ui/ConfirmDialog.vue index 5796b200..ea04a72b 100644 --- a/client/src/components/ui/ConfirmDialog.vue +++ b/client/src/components/ui/ConfirmDialog.vue @@ -5,7 +5,7 @@
{{ title }} - Hallo Velo +

@@ -22,6 +22,7 @@ import { Dialog, DialogPanel, DialogTitle } from "@headlessui/vue"; defineProps<{ isOpen: boolean; title: string; + content: string; }>(); const emit = defineEmits(["confirm", "close"]); diff --git a/client/src/pages/learningPath/circlePage/DocumentSection.vue b/client/src/pages/learningPath/circlePage/DocumentSection.vue index ff6b7fef..4e828b58 100644 --- a/client/src/pages/learningPath/circlePage/DocumentSection.vue +++ b/client/src/pages/learningPath/circlePage/DocumentSection.vue @@ -66,7 +66,8 @@ @@ -109,13 +110,16 @@ const dropdownLearningSequences = computed(() => name: sequence.title, })) ); -type ResolveReject = (v: any) => void; +// confirm dialog +// todo: refactor to own service +type ResolveReject = (v: unknown) => void; const showConfirm = ref(false); const confirm = ref(); const close = ref(); +const documentName = ref(""); const deleteDocument = (doc: CircleDocument) => { - // courseSessionsStore.removeDocument(doc.id); showConfirm.value = true; + documentName.value = doc.name; const modalDialog = new Promise((resolve, reject) => { confirm.value = resolve; close.value = reject; @@ -123,16 +127,15 @@ const deleteDocument = (doc: CircleDocument) => { modalDialog .then( () => { - console.log("confirmed"); courseSessionsStore.removeDocument(doc.id); + showConfirm.value = false; }, () => { - console.log("just closing"); + showConfirm.value = false; } ) .finally(() => { - console.log("closing"); - showConfirm.value = false; + documentName.value = ""; }); }; watch(showUploadModal, () => (showUploadErrorMessage.value = false));