Readd comments
This commit is contained in:
parent
1d97ec9dcf
commit
eaf12fbc87
|
|
@ -1,7 +1,15 @@
|
||||||
import { useCourseSessionsStore } from "@/stores/courseSessions";
|
import { useCourseSessionsStore } from "@/stores/courseSessions";
|
||||||
|
import type { CourseSession } from "@/types";
|
||||||
import log from "loglevel";
|
import log from "loglevel";
|
||||||
|
|
||||||
export function useCurrentCourseSession() {
|
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();
|
const store = useCourseSessionsStore();
|
||||||
|
|
||||||
if (!store.currentCourseSession) {
|
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;
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue