Skip to content

Commit

Permalink
fix: fallback: falseに変更してPage内に必ずarticleが入るようにした
Browse files Browse the repository at this point in the history
  • Loading branch information
TeXmeijin committed Aug 9, 2020
1 parent 5ddd42c commit 652ab8a
Showing 1 changed file with 9 additions and 3 deletions.
12 changes: 9 additions & 3 deletions pages/articles/[id].tsx
Original file line number Diff line number Diff line change
@@ -1,8 +1,14 @@
import { apiClient } from '../../modules/apiClient'
import { InferGetStaticPropsType, GetStaticPaths, GetStaticPropsContext } from 'next'
import {
InferGetStaticPropsType,
GetStaticPaths,
GetStaticPropsContext,
GetStaticProps
} from 'next'
import React from 'react'
import { MicroCmsArticle } from '../../types/microcms/type'

export const getStaticProps = async (context: GetStaticPropsContext<{id: string}>) => {
export const getStaticProps: GetStaticProps<{ article: MicroCmsArticle }> = async (context: GetStaticPropsContext<{id: string}>) => {
const { id } = context.params

const article = await apiClient.articles._cmsId(id).$get()
Expand All @@ -23,7 +29,7 @@ export const getStaticPaths: GetStaticPaths = async () => {
}
}
}),
fallback: true
fallback: false,
}
}

Expand Down

1 comment on commit 652ab8a

@vercel
Copy link

@vercel vercel bot commented on 652ab8a Aug 9, 2020

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Failed to assign a domain to your deployment due to the following error:

Deployment not found.

(Learn more or visit the non-aliased deployment)

Please sign in to comment.