webapp/src/pages/index.page.server.ts

21 lines
542 B
TypeScript
Raw Normal View History

2023-02-17 09:21:02 +00:00
import type { PageProps } from './types'
import type { PageContext } from '../renderer/types'
import { PRERENDERED_ARTICLES_COUNT } from '../components/Views/Home'
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' },
limit: PRERENDERED_ARTICLES_COUNT,
2023-02-17 09:21:02 +00:00
})
const pageProps: PageProps = { homeShouts, seo: { title: '' } }
2023-02-17 09:21:02 +00:00
return {
pageContext: {
pageProps,
},
2023-02-17 09:21:02 +00:00
}
}