industry.js
2.98 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
import React from "react";
import PageBanner from "@/components/reuseables/PageBanner";
import Education from "@/container/IndustryFocus/Education";
import Hospitality from "@/container/IndustryFocus/Hospitality";
import LifeSciences from "@/container/IndustryFocus/LifeSciences";
import RealEstate from "@/container/IndustryFocus/RealEstate";
import Technology from "@/container/IndustryFocus/Technology";
import axios from 'axios';
import qs from 'qs';
import { cleanImage } from "@/layout/imageHandling";
import IndustryOverview from "@/container/IndustryFocus/IndustryOverview";
import IndustryTab from "@/container/IndustryFocus/IndustryTab";
import Seo from "@/components/reuseables/Seo/Seo";
const industry = ({ IndustryPage }) => {
// console.log("conatct", IndustryPage)
const dynamicdata = IndustryPage?.IndustryDetails;
// console.log(dynamicdata , "dynamicdata")
const banners = [
{
imageSrc: cleanImage(IndustryPage?.Banner?.Image?.url),
pageTitle: IndustryPage?.Banner?.Heading,
homePageUrl: "/",
homePageText: "Home",
activePageText: IndustryPage?.Banner?.Heading,
},
];
const seo = IndustryPage?.seo;
// console.log(seo, "seo")
return (
<>
<Seo seo={seo} />
<PageBanner banners={banners} />
<section className="industry-details-page">
{dynamicdata &&
dynamicdata?.map((section, index) => {
console.log("section", section);
switch (section.__component) {
case "layout.industry-overview":
return <IndustryOverview title={section?.title} subtitle={section?.subtitle} description={section?.Description} image={section?.Image}/>;
case "layout.cfo-service":
return <IndustryTab
serviceTitle={section?.Title}
services={section?.IndustryServiceList}
/>
default:
return null;
}
})}
</section>
{/* <Education /> */}
{/* <Education />
<LifeSciences />
<Technology />
<RealEstate />
<Hospitality /> */}
</>
);
};
export default industry;
export async function getServerSideProps() {
try {
const query1 = {
populate: [
"Banner.Image",
"IndustryDetails",
"IndustryDetails.Image",
"IndustryDetails.IndustryServiceList",
"IndustryDetails.IndustryServiceList.CfoList",
"IndustryDetails.IndustryServiceList.CfoList.Icon",
"seo",
"seo.metaImage",
"seo.schema",
],
};
const query1String = qs.stringify(query1, {
encodeValuesOnly: true,
});
const endpoint1 = `${process.env.NEXT_PUBLIC_BACKEND_API_URL}/api/industry-page?${query1String}`;
console.log(`Final url: ${endpoint1}`);
const response1 = await axios.get(endpoint1);
const IndustryPage = response1.data.data;
return {
props: { IndustryPage },
};
} catch (error) {
console.log("Error", error);
}
}