Skip to content
Snippets Groups Projects
Commit f39783dd authored by Ron Lucke's avatar Ron Lucke
Browse files

biest-615

parent 66e483e9
No related branches found
No related tags found
No related merge requests found
<template> <template>
<div>
<div v-if="structureLoadingState === 'done'"> <div v-if="structureLoadingState === 'done'">
<courseware-structural-element <courseware-structural-element
:canVisit="canVisit" :canVisit="canVisit"
...@@ -14,16 +15,23 @@ ...@@ -14,16 +15,23 @@
</MountingPortal> </MountingPortal>
</div> </div>
<studip-progress-indicator <studip-progress-indicator
v-else v-if="structureLoadingState === 'loading'"
class="cw-loading-indicator-content" class="cw-loading-indicator-content"
:description="$gettext('Lade Lernmaterial...')" :description="$gettext('Lade Lernmaterial...')"
/> />
<courseware-companion-box
v-if="structureLoadingState === 'error'"
mood="sad"
:msgCompanion="loadingErrorMessage"
/>
</div>
</template> </template>
<script> <script>
import CoursewareStructuralElement from './CoursewareStructuralElement.vue'; import CoursewareStructuralElement from './CoursewareStructuralElement.vue';
import CoursewareViewWidget from './CoursewareViewWidget.vue'; import CoursewareViewWidget from './CoursewareViewWidget.vue';
import CoursewareActionWidget from './CoursewareActionWidget.vue'; import CoursewareActionWidget from './CoursewareActionWidget.vue';
import CoursewareCompanionBox from './CoursewareCompanionBox.vue';
import StudipProgressIndicator from '../StudipProgressIndicator.vue'; import StudipProgressIndicator from '../StudipProgressIndicator.vue';
import { mapActions, mapGetters } from 'vuex'; import { mapActions, mapGetters } from 'vuex';
...@@ -32,12 +40,14 @@ export default { ...@@ -32,12 +40,14 @@ export default {
CoursewareStructuralElement, CoursewareStructuralElement,
CoursewareViewWidget, CoursewareViewWidget,
CoursewareActionWidget, CoursewareActionWidget,
CoursewareCompanionBox,
StudipProgressIndicator, StudipProgressIndicator,
}, },
data: () => ({ data: () => ({
canVisit: null, canVisit: null,
selected: null, selected: null,
structureLoadingState: 'idle', structureLoadingState: 'idle',
loadingErrorStatus: null
}), }),
computed: { computed: {
...mapGetters({ ...mapGetters({
...@@ -49,6 +59,16 @@ export default { ...@@ -49,6 +59,16 @@ export default {
structuralElementById: 'courseware-structural-elements/byId', structuralElementById: 'courseware-structural-elements/byId',
userId: 'userId', userId: 'userId',
}), }),
loadingErrorMessage() {
switch (this.loadingErrorStatus) {
case 404:
return this.$gettext('Die Seite konnte nicht gefunden werden.');
case 403:
return this.$gettext('Diese Seite steht Ihnen leider nicht zur Verfügung.');
default:
return this.$gettext('Beim Laden der Seite ist ein Fehler aufgetreten.');
}
}
}, },
methods: { methods: {
...mapActions({ ...mapActions({
...@@ -71,7 +91,14 @@ export default { ...@@ -71,7 +91,14 @@ export default {
}, },
async mounted() { async mounted() {
this.structureLoadingState = 'loading'; this.structureLoadingState = 'loading';
try {
await this.loadCoursewareStructure(); await this.loadCoursewareStructure();
}
catch (error) {
this.loadingErrorStatus = error.status;
this.structureLoadingState = 'error';
return;
}
await this.loadTeacherStatus(this.userId); await this.loadTeacherStatus(this.userId);
this.structureLoadingState = 'done'; this.structureLoadingState = 'done';
const selectedId = this.$route.params?.id; const selectedId = this.$route.params?.id;
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment