From f3a9f2aa0fe9885fd5416d6c905fdb09ff329f87 Mon Sep 17 00:00:00 2001 From: imhson Date: Tue, 25 Jun 2024 11:32:37 +0700 Subject: [PATCH] fix campaign seo data --- src/pages/campaigns/[campaignSlug]/index.tsx | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/src/pages/campaigns/[campaignSlug]/index.tsx b/src/pages/campaigns/[campaignSlug]/index.tsx index b34098aa..16450340 100644 --- a/src/pages/campaigns/[campaignSlug]/index.tsx +++ b/src/pages/campaigns/[campaignSlug]/index.tsx @@ -39,18 +39,18 @@ export const getServerSideProps = async (context) => { const campaignLanguages = campaign.campaign_i18n.find((ml) => ml.i18n_language.id == 1) || campaign.campaign_i18n.find((ml) => ml.i18n_language.is_main) - - props.image = campaignLanguages?.data?.thumbnail_url - props.title = campaignLanguages?.data?.name - props.description = campaignLanguages?.data?.description + + props.image = campaignLanguages?.data?.seo?.thumbnail_url || campaignLanguages?.data?.thumbnail_url + props.title = campaignLanguages?.data?.seo?.name || campaignLanguages?.data?.name + props.description = campaignLanguages?.data?.seo?.description || campaignLanguages?.data?.description } else { const campaignLanguages = campaign.campaign_i18n.find((ml) => ml.i18n_language.id == 2) || campaign.campaign_i18n.find((ml) => ml.i18n_language.is_main) - props.image = campaignLanguages?.data?.thumbnail_url - props.title = campaignLanguages?.data?.name - props.description = campaignLanguages?.data?.description + props.image = campaignLanguages?.data?.seo?.thumbnail_url || campaignLanguages?.data?.thumbnail_url + props.title = campaignLanguages?.data?.seo?.name || campaignLanguages?.data?.name + props.description = campaignLanguages?.data?.seo?.description || campaignLanguages?.data?.description } return { props: {