valcucine.js
2.41 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
"use client";
import AboutInfoBrands from "@/components/valcucines/AboutInfoBrands";
import Certifications from "@/components/valcucines/Certifications";
import CompanyOverview from "@/components/valcucines/CompanyOverview";
import InnerBannerBrands from "@/components/valcucines/InnerBannerBrands";
import Breadcrumb from "@/components/Common/Breadcrumb";
import { Contact } from "@/container/Home/Contact";
import { getBrandsBySlug } from "@/services/brandsApi";
import Head from "next/head";
import { getValcucineBySlug } from "@/services/valcucineApi";
import { getRedisClient } from "@/redis-client";
const bannerData = [
{
id: 8,
title: "Valcucine",
description: "<p>Our doors are more than entryways—they are crafted statements of design, blending timeless aesthetics with modern functionality. Each piece defines spaces with sophistication and enduring style.</p>",
image: [
{
url: "/image/brands/valcucine.png",
},
{
url: "/image/brands/valcucine.png",
}
]
}
];
export default function valcucinesPage({ brandData, valcucineData }) {
const breadcrumbData = [
{
href: "/brands",
label: "Brands",
},
{
href: `/brands/`,
label: "valcucine",
},
];
return (
<>
<Head>
<title>Akruti</title>
</Head>
<Breadcrumb breadcrumbData={breadcrumbData} />
<InnerBannerBrands data={valcucineData?.banner} />
<AboutInfoBrands infoData={valcucineData?.info} />
<CompanyOverview companyOverviewData={valcucineData?.companyOverview} />
<Certifications certificationsData={valcucineData?.certifications} />
<Contact />
</>
);
}
export async function getServerSideProps({ params }) {
const redis = getRedisClient();
const REDIS_KEY = `${process.env.REDIS_KEY_PREFIX}_valcucine`;
const REDIS_EXPIRE = parseInt(process.env.REDIS_KEY_EXPIRE) || 86400;
try {
const cachedData = await redis.get(REDIS_KEY);
if (cachedData) {
console.log("redis data fetched");
return { props: { valcucineData: JSON.parse(cachedData) } };
}
const valcucineData = await getValcucineBySlug();
await redis.set(REDIS_KEY, JSON.stringify(valcucineData), "EX", REDIS_EXPIRE);
console.log("normal data fetched");
return { props: { valcucineData } };
} catch (error) {
console.error("Product page SSR error:", error);
return { notFound: true };
}
}