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.learningContent,
props.circle, props.circle,
previousRoute, previousRoute,
(lc: LearningContentWithCompletion) => { async (lc: LearningContentWithCompletion) => {
courseCompletionData.markCompletion(lc, "SUCCESS"); await courseCompletionData.markCompletion(lc, "SUCCESS");
} }
); );
} }

View File

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