<template>
  <WeddingA v-if="invitationData" :data="invitationData" />
</template>

<script setup>
import { ref, onMounted } from 'vue'
import { useRoute } from 'vue-router'
import WeddingA from '~/components/templates/wedding/WeddingA.vue'

const route = useRoute()
const invitationData = ref(null)

onMounted(async () => {
  try {
    const res = await fetch(`http://127.0.0.1:8000/api/pelanggan/${route.params.id}`)
    invitationData.value = await res.json()
  } catch (err) {
    console.error('Gagal ambil data:', err)
  }
})
</script>
