<template>
  <div class="homepage">
    <homepage-carousel :homepage-data="homepageData" :pending="pending" />
    <homepage-product-section
      :homepage-data="homepageData"
      :pending="pending"
    />
    <homepage-solution-section
      :homepage-data="homepageData"
      :pending="pending"
    />
  </div>
</template>

<script setup lang="ts">
  const { data, pending, error } = await useHomepage();

  const homepageData = computed(() => {
    return toHomepageView(data.value);
  });

  const pageTilte = $t('page-title.homepage');

  watch(error, (value) => {
    if (value) {
      logger.error('数据获取失败: ', value);
    }
  });

  useSeoMeta({
    title: pageTilte,
    description: $t('company-description'),
  });
</script>
