feat: handle navigation / redirect if user is not mentoring
This commit is contained in:
parent
eea1e95572
commit
514649f358
|
|
@ -1,34 +1,49 @@
|
|||
<script setup lang="ts">
|
||||
import { useRoute } from "vue-router";
|
||||
import { useRoute, useRouter } from "vue-router";
|
||||
import { useCurrentCourseSession } from "@/composables";
|
||||
import { onMounted } from "vue";
|
||||
|
||||
const route = useRoute();
|
||||
const router = useRouter();
|
||||
const courseSession = useCurrentCourseSession();
|
||||
|
||||
// if just a course session member -> hide navigation
|
||||
// and automatically redirect to mentorsAndParticipants
|
||||
const isMentoring = courseSession.value.actions.includes(
|
||||
"learning-mentor::guide-members"
|
||||
);
|
||||
|
||||
onMounted(() => {
|
||||
if (!isMentoring) {
|
||||
router.push({ name: "mentorsAndParticipants" });
|
||||
}
|
||||
});
|
||||
</script>
|
||||
|
||||
<template>
|
||||
<div class="bg-gray-200">
|
||||
<nav class="border-b bg-white px-4 lg:px-8">
|
||||
<nav v-if="isMentoring" class="border-b bg-white px-4 lg:px-8">
|
||||
<ul class="flex flex-col lg:flex-row">
|
||||
<li
|
||||
class="border-t-2 border-t-transparent"
|
||||
:class="{
|
||||
'border-b-2 border-b-blue-900':
|
||||
// all detail pages are under overview and prefixed
|
||||
// except for participants
|
||||
route.name?.toString().startsWith('learningMentor') &&
|
||||
route.name !== 'learningMentorParticipants',
|
||||
'border-b-2 border-b-blue-900': route.name
|
||||
?.toString()
|
||||
.startsWith('learningMentor'),
|
||||
}"
|
||||
>
|
||||
<router-link :to="{ name: 'learningMentorOverview' }" class="block py-3">
|
||||
{{ $t("a.Übersicht") }}
|
||||
</router-link>
|
||||
</li>
|
||||
|
||||
<li
|
||||
class="border-t-2 border-t-transparent lg:ml-12"
|
||||
:class="{
|
||||
'border-b-2 border-b-blue-900': route.name === 'learningMentorParticipants',
|
||||
'border-b-2 border-b-blue-900': route.name === 'mentorsAndParticipants',
|
||||
}"
|
||||
>
|
||||
<router-link :to="{ name: 'learningMentorParticipants' }" class="block py-3">
|
||||
<router-link :to="{ name: 'mentorsAndParticipants' }" class="block py-3">
|
||||
{{ $t("a.Personen") }}
|
||||
</router-link>
|
||||
</li>
|
||||
|
|
|
|||
|
|
@ -185,7 +185,7 @@ const router = createRouter({
|
|||
path: "participants",
|
||||
component: () =>
|
||||
import("@/pages/learningMentor/mentor/MentorParticipantsPage.vue"),
|
||||
name: "learningMentorParticipants",
|
||||
name: "mentorsAndParticipants",
|
||||
},
|
||||
{
|
||||
path: "self-evaluation-feedback/:learningUnitId",
|
||||
|
|
|
|||
Loading…
Reference in New Issue