fix: wait for completion before nav

This commit is contained in:
Reto Aebersold 2024-01-15 15:48:30 +01:00
parent 1310bf1d3d
commit f7aa5a35ca
2 changed files with 7 additions and 5 deletions

View File

@ -64,8 +64,8 @@ function handleFinishedLearningContent() {
props.learningContent,
props.circle,
previousRoute,
(lc: LearningContentWithCompletion) => {
courseCompletionData.markCompletion(lc, "SUCCESS");
async (lc: LearningContentWithCompletion) => {
await courseCompletionData.markCompletion(lc, "SUCCESS");
}
);
}

View File

@ -73,16 +73,18 @@ export const useCircleStore = defineStore({
});
}
},
continueFromLearningContent(
async continueFromLearningContent(
currentLearningContent: LearningContentWithCompletion,
circle: CircleType,
returnRoute?: RouteLocationNormalized,
markCompletionFn?: (learningContent: LearningContentWithCompletion) => void
markCompletionFn?: (
learningContent: LearningContentWithCompletion
) => Promise<void>
) {
if (currentLearningContent) {
if (currentLearningContent.can_user_self_toggle_course_completion) {
if (markCompletionFn) {
markCompletionFn(currentLearningContent);
await markCompletionFn(currentLearningContent);
}
}
this.closeLearningContent(currentLearningContent, circle, returnRoute);