Reload completion data correctly

This commit is contained in:
Daniel Egger 2022-11-09 21:08:56 +01:00
parent 05e6906878
commit 55d4ea6080
2 changed files with 7 additions and 3 deletions

View File

@ -37,7 +37,10 @@ onMounted(async () => {
<h2 class="mt-12 mb-3">Kurse</h2>
<div class="grid grid-cols-1 md:grid-cols-2 gap-4 auto-rows-fr">
<div v-for="courseSession in courseSessionsStore.courseSessions">
<div
v-for="courseSession in courseSessionsStore.courseSessions"
:key="courseSession.id"
>
<div class="bg-white p-6 md:h-full">
<h3 class="mb-4">{{ courseSession.title }}</h3>
<img class="mb-8 block" :src="'/static/icons/demo/vm-lernpfad.svg'" />

View File

@ -1,4 +1,4 @@
import { itGetCached, itPost } from "@/fetchHelpers";
import { bustItGetCache, itGetCached, itPost } from "@/fetchHelpers";
import type { BaseCourseWagtailPage, CourseCompletion } from "@/types";
import { defineStore } from "pinia";
@ -32,8 +32,9 @@ export const useCompletionStore = defineStore({
completion_status: page.completion_status,
});
if (completionData) {
if (completionData && completionData.length > 0) {
this.completionData = completionData;
bustItGetCache(`/api/course/completion/${completionData[0].course}/`);
}
return this.completionData || [];