2023-02-17 09:21:02 +00:00
|
|
|
import type { PageProps } from './types'
|
2023-11-14 15:10:00 +00:00
|
|
|
import type { PageContext } from '../renderer/types'
|
|
|
|
|
2023-09-27 14:33:06 +00:00
|
|
|
import { PRERENDERED_ARTICLES_COUNT } from '../components/Views/Home'
|
2023-11-14 15:10:00 +00:00
|
|
|
import { apiClient } from '../utils/apiClient'
|
2023-02-17 09:21:02 +00:00
|
|
|
|
|
|
|
export const onBeforeRender = async (_pageContext: PageContext) => {
|
|
|
|
const homeShouts = await apiClient.getShouts({
|
|
|
|
filters: { visibility: 'public' },
|
2023-11-14 15:10:00 +00:00
|
|
|
limit: PRERENDERED_ARTICLES_COUNT,
|
2023-02-17 09:21:02 +00:00
|
|
|
})
|
|
|
|
|
2023-11-14 10:45:44 +00:00
|
|
|
const pageProps: PageProps = { homeShouts, seo: { title: '' } }
|
2023-02-17 09:21:02 +00:00
|
|
|
|
|
|
|
return {
|
|
|
|
pageContext: {
|
2023-11-14 15:10:00 +00:00
|
|
|
pageProps,
|
|
|
|
},
|
2023-02-17 09:21:02 +00:00
|
|
|
}
|
|
|
|
}
|