This repository was archived by the owner on Jun 28, 2025. It is now read-only.
File tree Expand file tree Collapse file tree 3 files changed +21
-17
lines changed Expand file tree Collapse file tree 3 files changed +21
-17
lines changed Original file line number Diff line number Diff line change @@ -13,5 +13,3 @@ CMS_API_TOKEN_SALT=testtoken
13
13
CMS_ADMIN_JWT_SECRET = testsecret
14
14
CMS_JWT_SECRET = testsecret
15
15
CMS_TRANSFER_TOKEN_SALT = testtoken
16
-
17
- NODE_ENV = development
Original file line number Diff line number Diff line change @@ -24,22 +24,26 @@ export const metadata: Metadata = {
24
24
25
25
async function getPageProps ( ) {
26
26
const query = qs . stringify ( params , { addQueryPrefix : true } ) ;
27
- const respose = await fetch ( `${ process . env . CMS_API } /menus/1${ query } ` , {
28
- // headers: {
29
- // authorization: `Bearer ${process.env.CMS_TOKEN}`,
30
- // },
31
- } ) ;
32
- return ( await respose . json ( ) ) . data . attributes . items . data ;
27
+
28
+ try {
29
+ const response = await fetch ( `${ process . env . CMS_API } /menus/1${ query } ` , {
30
+ // headers: {
31
+ // authorization: `Bearer ${process.env.CMS_TOKEN}`,
32
+ // },
33
+ } ) ;
34
+
35
+ return ( await response . json ( ) ) . data . attributes . items . data ;
36
+ } catch ( error ) {
37
+ return [ ] ;
38
+ }
33
39
}
34
40
35
41
export default async function RootLayout ( { children } : { children : React . ReactNode } ) {
36
42
const pageProps = await getPageProps ( ) ;
37
43
38
44
return (
39
45
< html lang = "en" >
40
- < body className = { inter . className } >
41
- < Layout pages = { pageProps } > { children } </ Layout >
42
- </ body >
46
+ < body className = { inter . className } > { pageProps && < Layout pages = { pageProps } > { children } </ Layout > } </ body >
43
47
</ html >
44
48
) ;
45
49
}
Original file line number Diff line number Diff line change
1
+ // @ts -nocheck
1
2
"use client" ;
2
- import React , { useEffect , useRef } from "react" ;
3
- import { register } from "swiper/element" ;
3
+ import React , { PropsWithChildren , useEffect , useRef } from "react" ;
4
+ import { register , SwiperContainer } from "swiper/element" ;
4
5
5
- // eslint-disable-next-line @typescript-eslint/no-explicit-any
6
- export function Carousel ( props : { [ x : string ] : any ; children : any } ) {
7
- const swiperRef = useRef ( null ) ;
6
+ export function Carousel ( props : PropsWithChildren < Record < string , unknown > > ) {
7
+ const swiperRef = useRef < SwiperContainer > ( null ) ;
8
8
const { children, ...rest } = props ;
9
9
10
10
useEffect ( ( ) => {
11
+ if ( ! swiperRef . current ) return ;
11
12
// Register Swiper web component
12
13
register ( ) ;
13
14
@@ -21,7 +22,7 @@ export function Carousel(props: { [x: string]: any; children: any }) {
21
22
22
23
// initialize swiper
23
24
swiperRef . current . initialize ( ) ;
24
- } , [ ] ) ;
25
+ } , [ rest , swiperRef ] ) ;
25
26
26
27
return (
27
28
< swiper-container init = "false" ref = { swiperRef } >
@@ -32,5 +33,6 @@ export function Carousel(props: { [x: string]: any; children: any }) {
32
33
export function CarouselSlide ( props ) {
33
34
const { children, ...rest } = props ;
34
35
36
+ // @ts -ignore
35
37
return < swiper-slide { ...rest } > { children } </ swiper-slide > ;
36
38
}
You can’t perform that action at this time.
0 commit comments