11import { observer } from 'mobx-react' ;
2- import { GetStaticProps } from 'next' ;
2+ import { cache , compose , errorLogger } from 'next-ssr-middleware ' ;
33import { FC , useContext } from 'react' ;
44import { Card , Col , Row } from 'react-bootstrap' ;
55import { renderToStaticMarkup } from 'react-dom/server' ;
66import ReactTyped from 'react-typed-component' ;
7- import { Day , Second } from 'web-utility' ;
87
98import { HeroCarousel } from '../components/Activity/HeroCarousel' ;
109import { PageHead } from '../components/Layout/PageHead' ;
@@ -16,14 +15,11 @@ interface HomePageProps {
1615 activities : Activity [ ] ;
1716}
1817
19- export const getStaticProps : GetStaticProps < HomePageProps > = async ( ) => {
18+ export const getServerSideProps = compose ( cache ( ) , errorLogger , async ( ) => {
2019 const activities = await new ActivityModel ( ) . getList ( { } , 1 , 3 ) ;
2120
22- return {
23- props : JSON . parse ( JSON . stringify ( { activities } ) ) ,
24- revalidate : Day / Second ,
25- } ;
26- } ;
21+ return { props : JSON . parse ( JSON . stringify ( { activities } ) ) } ;
22+ } ) ;
2723
2824const HomePage : FC < HomePageProps > = observer ( ( { activities } ) => {
2925 const { t } = useContext ( I18nContext ) ;
0 commit comments