<template>
  <NuxtPage />
</template>

<script setup lang="ts">
import type SEOComponent from "./types/component/seoComponent";
import type Global from "./types/single/global";

const runtimeConfig = useRuntimeConfig();
const appTitle = runtimeConfig.public.app.title;

const { findOne, find } = useStrapi();
const { data: global } = await useAsyncData("global", () => findOne<Global>("global"));

const {
  metaTitle, metaDescription, keywords,
} = global.value?.data?.SEO ?? ({} as SEOComponent);

useHead({
  title: metaTitle ?? appTitle,
  meta: [
    {name: "description", content: metaDescription},
    {name: "keywords", content: keywords},
  ]
});
</script>