Files
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 14:25:21 +03:00
import type { PageProps } from './types'
2024-01-11 10:02:36 +03:00
import { PRERENDERED_ARTICLES_COUNT } from '../components/Views/Home'
2023-11-28 16:18:25 +03:00
import { apiClient } from '../graphql/client/core'
2023-02-17 10:21:02 +01:00
export const onBeforeRender = async (_pageContext: PageContext) => {
2024-01-11 10:02:36 +03:00
const homeShouts = await apiClient.getShouts({
filters: { featured: true },
2024-01-11 10:02:36 +03:00
limit: PRERENDERED_ARTICLES_COUNT,
})
2023-12-27 02:28:26 +03:00
2024-01-11 10:02:36 +03:00
const pageProps: PageProps = { homeShouts, seo: { title: '' } }
2023-02-17 10:21:02 +01:00
return {
pageContext: {
pageProps,
},
2023-02-17 10:21:02 +01:00
}
}