<script lang="ts" setup>
  import { watch } from 'vue'
  import { useRoute } from 'vue-router'
  import { useLanguage } from '@/composables/localization/language.ts'
  import { useAppStore } from '@/stores/app'

  const route = useRoute()
  const appStore = useAppStore()
  const { parseTitlePage } = useLanguage()

  watch(
    () => route.meta.title,
    newTitle => {
      useTitle(newTitle ? `${parseTitlePage(newTitle as string, route.meta?.transParam as Record<string, string>)} | ${appStore.appName}` : appStore.appName)
    },
    { immediate: true },
  )

</script>

<template>
  <v-app>
    <router-view />
  </v-app>
</template>
