cms-datocms SerializableError fixes (#10986)

This commit is contained in:
Brad Larson 2020-03-12 08:07:57 -04:00 committed by GitHub
parent a86184eb89
commit 3b5029fb92
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 2 additions and 2 deletions

View file

@ -36,7 +36,7 @@ export default function Index({ allPosts }) {
}
export async function getStaticProps({ preview }) {
const allPosts = await getAllPostsForHome(preview)
const allPosts = await getAllPostsForHome(preview) || []
return {
props: { allPosts },
}

View file

@ -50,7 +50,7 @@ export default function Post({ post, morePosts, preview }) {
)
}
export async function getStaticProps({ params, preview }) {
export async function getStaticProps({ params, preview = null }) {
const data = await getPostAndMorePosts(params.slug, preview)
const content = await markdownToHtml(data?.post?.content || '')