diff --git a/client/src/components/circle/LearningSequence.vue b/client/src/components/circle/LearningSequence.vue index ebca7021..3c584df8 100644 --- a/client/src/components/circle/LearningSequence.vue +++ b/client/src/components/circle/LearningSequence.vue @@ -8,8 +8,8 @@ defineProps(['learningSequence'])

{{ learningSequence.title }}

-
-

{{ learningPackage.id }}

+
+ {{ learningUnit.title }}
diff --git a/client/src/views/Circle.vue b/client/src/views/Circle.vue index 4089933d..a9b7f7f9 100644 --- a/client/src/views/Circle.vue +++ b/client/src/views/Circle.vue @@ -11,17 +11,31 @@ export default { data() { return { count: 0, - circleData: {} + circleData: {}, + learningSequences: [], } }, mounted() { log.debug('CircleAnalyseExampleView mounted', this.circleSlug); axios({ method: 'get', - url: `/wagtailapi/v2/pages/?type=learnpath.Circle&slug=${this.circleSlug}&fields=title,description,learning_sequences(title,learning_packages(title,my_title,learning_units(title)))`, + url: `/learnpath/api/circle/${this.circleSlug}/`, }).then((response) => { - log.debug(response.data.items[0]); - this.circleData = response.data.items[0]; + log.debug(response.data); + this.circleData = response.data; + + let learningSequence = { learningUnits: [] }; + this.circleData.children.forEach((child) => { + if (child.type === 'learnpath.LearningSequence') { + if (learningSequence.learningUnits.length) { + this.learningSequences.push(learningSequence); + } + learningSequence = Object.assign(child, { learningUnits: [] }); + } else { + learningSequence.learningUnits.push(child); + } + }); + log.debug(this.learningSequences); }); } @@ -61,7 +75,7 @@ export default {
-
+
diff --git a/server/config/urls.py b/server/config/urls.py index aee079ea..25023fe1 100644 --- a/server/config/urls.py +++ b/server/config/urls.py @@ -18,7 +18,7 @@ from vbv_lernwelt.core.middleware.auth import django_view_authentication_exempt from vbv_lernwelt.core.views import ( rate_limit_exceeded_view, permission_denied_view, - check_rate_limit, cypress_reset_view, + check_rate_limit, cypress_reset_view, vue_home, ) from .wagtail_api import wagtail_api_router @@ -112,5 +112,5 @@ if settings.DEBUG: # serve everything else via the vue app -# urlpatterns += [re_path(r'^.*$', vue_home, name='home')] +urlpatterns += [re_path(r'^.*$', vue_home, name='home')]