<template>
  <router-view/>
</template>

<script setup lang="ts">
  import { inject, onMounted } from 'vue'
  import { useRouter } from 'vue-router'
  import type { WebApp } from '@twa-dev/types'
  import { useTextSizeStore } from './stores/textSize'

  const router = useRouter()
  const tg = inject('tg') as WebApp
  tg.onEvent('settingsButtonClicked', async () => {
    await router.push({ name: 'settings' })
  })

  const textSizeStore = useTextSizeStore()
  onMounted(async () => {
  try {
    await textSizeStore.initialize()
  } catch (err) {
    console.error('Error load font size:', err)
  }
})
  
</script>
