webapp/src/pages/search.page.server.ts
2023-02-17 10:21:02 +01:00

18 lines
457 B
TypeScript

import type { PageContext } from '../renderer/types'
import { apiClient } from '../utils/apiClient'
import type { PageProps } from './types'
export const onBeforeRender = async (pageContext: PageContext) => {
const { q } = pageContext.routeParams
const searchResults = await apiClient.getShouts({ filters: { title: q, body: q }, limit: 50 })
const pageProps: PageProps = { searchResults }
return {
pageContext: {
pageProps
}
}
}