_app.js
1.05 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
import "bootstrap/dist/css/bootstrap.min.css";
import "@/styles/globals.css";
import "@/styles/style.css";
import Header from "@/components/Layout/Header";
import Head from "next/head";
import Footer from "@/components/Layout/Footer";
import Providers from "@/redux/providers";
import { store } from "@/redux/store";
import SmoothScroll from "@/components/SmoothScroll";
import { getCollectionPageData } from "@/services/collectionApi";
export default function App({ Component, pageProps, collectionsData}) {
return (
<>
<Providers store={store}>
{/* <SmoothScroll> */}
<Header collectionsData={collectionsData} />
<Component {...pageProps} />
<Footer />
{/* </SmoothScroll> */}
</Providers>
</>
);
}
/* ✅ THIS IS REQUIRED */
App.getInitialProps = async () => {
try {
const collectionsData = await getCollectionPageData();
return {
collectionsData,
};
} catch (error) {
console.error("Collections fetch failed", error);
return {
collectionsData: [],
};
}
};