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'
|
|
|
|
|
2024-01-11 07:02:36 +00:00
|
|
|
import { PRERENDERED_ARTICLES_COUNT } from '../components/Views/Home'
|
2023-11-28 13:18:25 +00:00
|
|
|
import { apiClient } from '../graphql/client/core'
|
2023-02-17 09:21:02 +00:00
|
|
|
|
|
|
|
export const onBeforeRender = async (_pageContext: PageContext) => {
|
2024-01-11 07:02:36 +00:00
|
|
|
const homeShouts = await apiClient.getShouts({
|
2024-02-02 17:29:53 +00:00
|
|
|
filters: { featured: true },
|
2024-01-11 07:02:36 +00:00
|
|
|
limit: PRERENDERED_ARTICLES_COUNT,
|
|
|
|
})
|
2023-12-26 23:28:26 +00:00
|
|
|
|
2024-01-11 07:02:36 +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
|
|
|
}
|
|
|
|
}
|