<template>
  <IndexContent :slug="slug" />
</template>

<script setup>
  import { useModalStore } from "@/stores/ModalStore"
  import { watch } from "vue"

  const route = useRoute()
  const modalStore = useModalStore()
  const router = useRouter()

  const slug = route.params.slug

  watch(() => modalStore.isOpen, (isOpen) => {
    if (!isOpen) {
      router.push('/')
    }
  })
</script>
