<script setup lang="ts">
import { useConfigStore } from "@/stores/config";
import { useTocStore } from "@/stores/toc";
import { onMounted } from "vue";
import { useRoute } from "vue-router";
import MarkdownFile from "../components/MarkdownFile.vue";

const store = useConfigStore();
const toc = useTocStore();
const route = useRoute();

onMounted(() => {
  toc.resetToc();
  store.loadJdr(`${route.params.jdr}`);
});
</script>

<template>
  <main>
    <MarkdownFile
      :path="`rules/${$route.params.category}/${$route.params.filepath}`"
    />
  </main>
</template>
