<script setup lang="ts">
import { useCourseSessionDetailQuery } from "@/composables";
import { useCockpitStore } from "@/stores/cockpit";
import * as log from "loglevel";
import { onMounted } from "vue";

log.debug("CockpitParentPage created");

const props = defineProps<{
  courseSlug: string;
}>();

const cockpitStore = useCockpitStore();
const courseSessionDetailResult = useCourseSessionDetailQuery();

onMounted(async () => {
  log.debug("CockpitParentPage mounted", props.courseSlug);

  try {
    await courseSessionDetailResult.waitForData();
    await cockpitStore.loadCircles(
      props.courseSlug,
      courseSessionDetailResult.findCurrentUser()
    );
    // const members = courseSessionDetailResult.filterMembers().map((m) => {
    //   return {}
    // });
  } catch (error) {
    log.error(error);
  }
});
</script>

<template>
  <div class="bg-gray-200">
    <main>
      <router-view></router-view>
    </main>
  </div>
</template>

<style scoped></style>
