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

18 lines
435 B
TypeScript
Raw Normal View History

2023-02-17 09:21:02 +00:00
import type { PageContext } from '../renderer/types'
import { apiClient } from '../utils/apiClient'
import type { PageProps } from './types'
export const onBeforeRender = async (pageContext: PageContext) => {
const { slug } = pageContext.routeParams
const topic = await apiClient.getTopic({ slug })
const pageProps: PageProps = { topic, seo: { title: topic.title } }
2023-02-17 09:21:02 +00:00
return {
pageContext: {
pageProps
}
}
}