Initial Changes
This commit is contained in:
@@ -20,13 +20,31 @@ const getConsultantPageData = async () => {
|
|||||||
return data.data;
|
return data.data;
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
console.error("Error fetching data:", error);
|
console.error("Error fetching data:", error);
|
||||||
return null;
|
return undefined;
|
||||||
}
|
}
|
||||||
// Pass data to the page via props
|
// Pass data to the page via props
|
||||||
};
|
};
|
||||||
|
|
||||||
async function Page() {
|
async function Page() {
|
||||||
const data = await getConsultantPageData();
|
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 (
|
return (
|
||||||
<div>
|
<div>
|
||||||
<PremiumBanner data={data} />
|
<PremiumBanner data={data} />
|
||||||
@@ -34,27 +52,9 @@ async function Page() {
|
|||||||
<PremiumBannerTwo data={data} />
|
<PremiumBannerTwo data={data} />
|
||||||
<PremuimBannerThree
|
<PremuimBannerThree
|
||||||
data={data}
|
data={data}
|
||||||
categoriesForPremiumThree={
|
categoriesForPremiumThree={consultationReasons}
|
||||||
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}
|
|
||||||
/>
|
/>
|
||||||
|
<PremiumBannerLast services={perksServices} data={data} />
|
||||||
</div>
|
</div>
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user