Readd comments

This commit is contained in:
Daniel Egger 2023-05-17 18:33:05 +02:00
parent 1d97ec9dcf
commit eaf12fbc87
1 changed files with 10 additions and 1 deletions

View File

@ -1,7 +1,15 @@
import { useCourseSessionsStore } from "@/stores/courseSessions";
import type { CourseSession } from "@/types";
import log from "loglevel";
export function useCurrentCourseSession() {
/**
* We often need the current course session in our components.
* With this composable we can get it easily.
* ATTENTION: The value is not reactive! So the components need to be re-rendered
* when the value changes. This is currently done with the "switchedCourseSession"
* event handler in the App.vue component.
*/
const store = useCourseSessionsStore();
if (!store.currentCourseSession) {
@ -14,5 +22,6 @@ export function useCurrentCourseSession() {
);
}
return store.currentCourseSession;
// return the current NON-REACTIVE course session
return store.currentCourseSession as CourseSession;
}