Skip to content

Commit

Permalink
fix: page.router
Browse files Browse the repository at this point in the history
update to query + add await
  • Loading branch information
seaerchin committed Jun 25, 2024
1 parent a76246b commit b3acf31
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 6 deletions.
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import {
type IsomerComponent,
type IsomerPageSchema,
RenderEngine,
} from '@opengovsg/isomer-components'
Expand Down Expand Up @@ -50,7 +51,8 @@ export default function Preview({ schema }: PreviewProps) {
permalink: '/',
lastModified: new Date().toISOString(),
}}
content={renderSchema.content}
// TODO: remove this cast and add validation
content={data.content.content as IsomerComponent[]}
/>
)
}
8 changes: 3 additions & 5 deletions apps/studio/src/server/modules/page/page.router.ts
Original file line number Diff line number Diff line change
Expand Up @@ -17,19 +17,17 @@ export const pageRouter = router({
.input(getEditPageSchema)
.query(async ({ input, ctx }) => {
const { pageId } = input
// const page = await getFullPageById(pageId)
const page = await getFullPageById(pageId)
// TODO: Fill these in later
const pageName: string = page.name
const siteMeta = getSiteConfig(page.siteId)
const navbar = getNavBar(page.siteId)
const footer = getFooter(page.siteId)
const navbar = await getNavBar(page.siteId)
const footer = await getFooter(page.siteId)
const { content } = page

return {
pageName,
// NOTE: might shift theme, isGovt, navbar, footer out into separate function?
// because this is shared across the whole site (site level props)
...siteMeta,
navbar,
footer,
content,
Expand Down

0 comments on commit b3acf31

Please sign in to comment.