diff --git a/components/content/LinkCard.vue b/components/content/LinkCard.vue index 99e4f66..88c6f13 100644 --- a/components/content/LinkCard.vue +++ b/components/content/LinkCard.vue @@ -10,36 +10,33 @@ const props = withDefaults(defineProps(), { const params = { url: props.url }; const query = new URLSearchParams(params); -let data: Object | null = null; - -try { +const { state } = useAsyncState(async () => { const response = await fetch(`${import.meta.env.VITE_NUXT_PUBLIC_SITE_URL}/api/ogp?${query}`); - if (response.ok) { - data = await response?.json(); + return await response?.json(); } -} catch (error) {} +}, null);