
* WIP * WIP * lint * package-lock.json * test * test * meta tags fixed * dynamic titles fix --------- Co-authored-by: Igor Lobanov <igor.lobanov@onetwotrip.com>
23 lines
674 B
TypeScript
23 lines
674 B
TypeScript
import type { PageContext } from '../renderer/types'
|
|
import { apiClient } from '../utils/apiClient'
|
|
import type { PageProps } from './types'
|
|
import { PRERENDERED_ARTICLES_COUNT } from '../components/Views/Author'
|
|
|
|
export const onBeforeRender = async (pageContext: PageContext) => {
|
|
const { slug } = pageContext.routeParams
|
|
|
|
const authorShouts = await apiClient.getShouts({
|
|
filters: { author: slug, visibility: 'community' },
|
|
limit: PRERENDERED_ARTICLES_COUNT
|
|
})
|
|
const author = await apiClient.getAuthor({ slug })
|
|
|
|
const pageProps: PageProps = { author, authorShouts, seo: { title: author.name } }
|
|
|
|
return {
|
|
pageContext: {
|
|
pageProps
|
|
}
|
|
}
|
|
}
|