Initial Changes
This commit is contained in:
@@ -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: <img src={`${backendUrl}${item.image?.path}`} alt={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 (
|
||||
<div>
|
||||
<PremiumBanner data={data} />
|
||||
@@ -34,27 +52,9 @@ async function Page() {
|
||||
<PremiumBannerTwo data={data} />
|
||||
<PremuimBannerThree
|
||||
data={data}
|
||||
categoriesForPremiumThree={
|
||||
data?.consultation_reasons?.map((item, index) => ({
|
||||
title: item.title,
|
||||
description: item.description,
|
||||
logo: (
|
||||
<img src={`${backendUrl}${item.image?.path}`} alt={item.title} />
|
||||
),
|
||||
})) ?? categoriesForPremiumThree
|
||||
}
|
||||
/>
|
||||
<PremiumBannerLast
|
||||
services={data?.perks?.map((item) => ({
|
||||
title: item.title,
|
||||
description: item.description,
|
||||
imageUrl: [
|
||||
`${backendUrl}${item.image1?.path}`,
|
||||
`${backendUrl}${item.image2?.path}`,
|
||||
],
|
||||
}))}
|
||||
data={data}
|
||||
categoriesForPremiumThree={consultationReasons}
|
||||
/>
|
||||
<PremiumBannerLast services={perksServices} data={data} />
|
||||
</div>
|
||||
);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user