@@ -8,21 +8,24 @@ import '../assets/styles/global.css'
88import Theme from '../assets/styles/theme'
99import { NextSeo } from 'next-seo'
1010import Head from 'next/head'
11+ import { getSponsorList } from './api/sponsor'
12+ import { ISponsorList } from '../interfaces/ISponsor'
1113
1214const App = ( {
1315 Component,
1416 pageProps,
1517 locale,
16- router
17- } : AppProps & { locale : string } ) => {
18+ router,
19+ sponsorList
20+ } : AppProps & { locale : string ; sponsorList : ISponsorList } ) => {
1821 const i18n = React . useMemo ( ( ) => createI18n ( { locale } ) , [ locale ] )
1922 const { t } = useTranslation ( )
2023 const { pathname } = router
2124
2225 const pageName = pageProps ?. title ?? ''
2326 const description = `${ t ( `label:pyconkrTitle` ) } : ${ t ( `label:pyconkrDate` ) } `
2427
25- const hideSponsor = pathname === '/sponsor'
28+ const hideSponsor = pathname . includes ( '/sponsor' )
2629
2730 const getPageTitle = ( ) : string => {
2831 if ( i18n . exists ( `pageTitle:${ pageName } ` ) ) {
@@ -61,6 +64,7 @@ const App = ({
6164 locale = { locale }
6265 pageName = { pageName }
6366 hideSponsor = { hideSponsor }
67+ sponsorList = { sponsorList }
6468 >
6569 < Component pageName = { pageName } { ...pageProps } />
6670 </ Layout >
@@ -72,7 +76,12 @@ const App = ({
7276
7377App . getInitialProps = async ( { ctx } : AppContext ) => {
7478 const { locale } = ctx
75- return { locale }
79+ const data = await getSponsorList ( )
80+
81+ return {
82+ locale,
83+ sponsorList : data
84+ }
7685}
7786
7887export default App
0 commit comments