diff --git a/web/src/router/index.ts b/web/src/router/index.ts index fddab83..81361bf 100644 --- a/web/src/router/index.ts +++ b/web/src/router/index.ts @@ -313,15 +313,6 @@ router.beforeEach((to) => { return { name: 'login', query: { redirect: to.fullPath } } } if (to.name === 'login' && auth.isLoggedIn) return { name: 'dashboard' } - if ( - to.name === 'dashboard' && - auth.user?.roles.includes('Student') && - !auth.user.roles.some((role) => - ['SuperAdmin', 'AcademicAdmin', 'CollegeAdmin'].includes(role), - ) - ) { - return { name: 'course-selections' } - } const roles = to.meta.roles as string[] | undefined if (roles && !roles.some((role) => auth.user?.roles.includes(role))) { return { name: 'dashboard' } diff --git a/web/src/views/DashboardView.vue b/web/src/views/DashboardView.vue index ba59d90..715bd30 100644 --- a/web/src/views/DashboardView.vue +++ b/web/src/views/DashboardView.vue @@ -4,6 +4,7 @@ import { useRouter } from 'vue-router' import { Collection, OfficeBuilding, School, UserFilled } from '@element-plus/icons-vue' import http from '../api/http' import { useAuthStore } from '../stores/auth' +import StudentDashboardView from './StudentDashboardView.vue' interface DashboardData { currentTerm?: { name: string; startDate: string; endDate: string } @@ -12,6 +13,12 @@ interface DashboardData { const router = useRouter() const auth = useAuthStore() +const isStudentOverview = computed(() => + auth.user?.roles.includes('Student') && + !auth.user.roles.some((role) => + ['SuperAdmin', 'AcademicAdmin', 'CollegeAdmin'].includes(role), + ), +) const loading = ref(true) const data = ref({ counts: {} }) @@ -23,6 +30,10 @@ const stats = computed(() => [ ]) onMounted(async () => { + if (isStudentOverview.value) { + loading.value = false + return + } try { data.value = (await http.get('/dashboard')).data } finally { @@ -32,7 +43,8 @@ onMounted(async () => {