webapp/src/pages/article.page.server.ts
2023-05-08 19:29:26 +02:00

17 lines
411 B
TypeScript

import type { PageContext } from '../renderer/types'
import type { PageProps } from './types'
import { apiClient } from '../utils/apiClient'
export const onBeforeRender = async (pageContext: PageContext) => {
const { slug } = pageContext.routeParams
const article = await apiClient.getShoutBySlug(slug)
const pageProps: PageProps = { article }
return {
pageContext: {
pageProps
}
}
}