Refactor document handling take2

This commit is contained in:
Daniel Egger 2023-10-06 18:59:43 +02:00
parent 000e963730
commit a1f2c8cd12
1 changed files with 20 additions and 2 deletions

View File

@ -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}`,
}))
);