diff --git a/app/products/premium-rudraksha-consultation-astrology/page.jsx b/app/products/premium-rudraksha-consultation-astrology/page.jsx index d149cdd..153dee7 100644 --- a/app/products/premium-rudraksha-consultation-astrology/page.jsx +++ b/app/products/premium-rudraksha-consultation-astrology/page.jsx @@ -20,13 +20,31 @@ const getConsultantPageData = async () => { return data.data; } catch (error) { console.error("Error fetching data:", error); - return null; + return undefined; } // Pass data to the page via props }; async function Page() { const data = await getConsultantPageData(); + + const consultationReasons = Array.isArray(data?.consultation_reasons) + ? data.consultation_reasons.map((item) => ({ + title: item.title, + description: item.description, + logo: {item.title}, + })) + : categoriesForPremiumThree; + const perksServices = Array.isArray(data?.perks) + ? data.perks.map((item) => ({ + title: item.title, + description: item.description, + imageUrl: [ + `${backendUrl}${item.image1?.path}`, + `${backendUrl}${item.image2?.path}`, + ], + })) + : undefined; return (
@@ -34,27 +52,9 @@ async function Page() { ({ - title: item.title, - description: item.description, - logo: ( - {item.title} - ), - })) ?? categoriesForPremiumThree - } - /> - ({ - title: item.title, - description: item.description, - imageUrl: [ - `${backendUrl}${item.image1?.path}`, - `${backendUrl}${item.image2?.path}`, - ], - }))} - data={data} + categoriesForPremiumThree={consultationReasons} /> +
); }