From 1ab5052d0d8e5383ab9b3ca215f527850bfacc7e Mon Sep 17 00:00:00 2001 From: Livio Bieri Date: Thu, 1 Feb 2024 18:29:22 +0100 Subject: [PATCH] fix: automagically forward to last page if already submitted --- .../mentor/SelfEvaluationFeedback.vue | 20 ++++++++++++++++++- 1 file changed, 19 insertions(+), 1 deletion(-) diff --git a/client/src/pages/cockpit/cockpitPage/mentor/SelfEvaluationFeedback.vue b/client/src/pages/cockpit/cockpitPage/mentor/SelfEvaluationFeedback.vue index 08a164f6..d04695e2 100644 --- a/client/src/pages/cockpit/cockpitPage/mentor/SelfEvaluationFeedback.vue +++ b/client/src/pages/cockpit/cockpitPage/mentor/SelfEvaluationFeedback.vue @@ -2,7 +2,7 @@ import LearningContentMultiLayout from "@/pages/learningPath/learningContentPage/layouts/LearningContentMultiLayout.vue"; import LearningContentContainer from "@/pages/learningPath/learningContentPage/LearningContentContainer.vue"; import { useRouter } from "vue-router"; -import { computed, ref } from "vue"; +import { computed, ref, watch } from "vue"; import { type Criterion, useSelfEvaluationFeedback, @@ -29,6 +29,24 @@ const selfEvaluationFeedback = useSelfEvaluationFeedback( const feedback = computed(() => selfEvaluationFeedback?.feedback.value); +watch( + () => feedback.value, + () => { + if (feedback.value && feedback.value.feedback_submitted) { + console.info("Feedback submitted, redirecting to overview page!"); + router.push({ + name: "mentorSelfEvaluationFeedback", + params: { + learningUnitId: props.learningUnitId, + }, + query: { + step: feedback.value.criteria.length, + }, + }); + } + } +); + const title = computed(() => { if (feedback.value) { return feedback.value.title;