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

21 lines
570 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'
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) => {
2023-11-29 08:23:08 +00:00
const options = {
2023-11-29 12:19:25 +00:00
filters: { published: true },
limit: PRERENDERED_ARTICLES_COUNT,
2023-11-29 08:23:08 +00:00
}
const homeShouts = await apiClient.getShouts({ options })
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
}
}