From a1f2c8cd120489ecdfc0edc819c769f70ea3cd23 Mon Sep 17 00:00:00 2001 From: Daniel Egger Date: Fri, 6 Oct 2023 18:59:43 +0200 Subject: [PATCH] Refactor document handling take2 --- .../cockpit/documentPage/DocumentPage.vue | 22 +++++++++++++++++-- 1 file changed, 20 insertions(+), 2 deletions(-) diff --git a/client/src/pages/cockpit/documentPage/DocumentPage.vue b/client/src/pages/cockpit/documentPage/DocumentPage.vue index 61908215..d96f0f96 100644 --- a/client/src/pages/cockpit/documentPage/DocumentPage.vue +++ b/client/src/pages/cockpit/documentPage/DocumentPage.vue @@ -4,7 +4,7 @@ import ItDropdownSelect from "@/components/ui/ItDropdownSelect.vue"; import { useCockpitStore } from "@/stores/cockpit"; import ItModal from "@/components/ui/ItModal.vue"; import DocumentUploadForm from "@/pages/cockpit/documentPage/DocumentUploadForm.vue"; -import { computed, ref, watch } from "vue"; +import { computed, onMounted, ref, watch } from "vue"; import { useTranslation } from "i18next-vue"; import type { CircleDocument, DocumentUploadData } from "@/types"; import dialog from "@/utils/confirm-dialog"; @@ -27,10 +27,28 @@ const showUploadModal = ref(false); const showUploadErrorMessage = ref(false); const isUploading = ref(false); +onMounted(async () => { + log.debug("DocumentPage mounted"); +}); + +watch( + // workaround to load learning sequences when circle changes + () => cockpitStore.currentCircle, + async () => { + if (cockpitStore.currentCircle) { + await circleStore.loadCircle( + courseSession.value?.course.slug, + cockpitStore.currentCircle?.slug + ); + } + }, + { immediate: true } +); + const dropdownLearningSequences = computed(() => circleStore.circle?.learningSequences.map((sequence) => ({ id: sequence.id, - name: sequence.title, + name: `${sequence.title} ${sequence.id}`, })) );