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

21 lines
540 B
TypeScript
Raw Normal View History

import type { PageContext } from '../renderer/types'
2024-02-04 11:25:21 +00:00
import type { PageProps } from './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({
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: {
pageProps,
},
2023-02-17 09:21:02 +00:00
}
}