Skip to content

Commit

Permalink
fix(kuji): catch error in head (#2307)
Browse files Browse the repository at this point in the history
  • Loading branch information
ykzts committed Nov 2, 2022
1 parent 8b7b716 commit 7ab12fa
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 7 deletions.
10 changes: 8 additions & 2 deletions app/(content)/kuji/[id]/head.tsx
Original file line number Diff line number Diff line change
@@ -1,9 +1,15 @@
import { getFortune, getImageURL } from '@/lib/contentful'
import { type Fortune, getFortune, getImageURL } from '@/lib/contentful'
import SEO from '@/ui/SEO'
import { type Props, generateFortuneName } from './page'

export default async function Head({ params }: Props): Promise<JSX.Element> {
const fortune = await getFortune(params.id)
let fortune: Fortune
try {
fortune = await getFortune(params.id)
} catch {
return <></>
}

const name = generateFortuneName(fortune)
const title = `因幡はねるくじ ${name}`

Expand Down
10 changes: 5 additions & 5 deletions tsconfig.json
Original file line number Diff line number Diff line change
Expand Up @@ -19,15 +19,15 @@
"@/styles/*": ["./styles/*"],
"@/ui/*": ["./ui/*"]
},
"resolveJsonModule": true,
"skipLibCheck": true,
"strict": true,
"target": "es2021",
"plugins": [
{
"name": "next"
}
]
],
"resolveJsonModule": true,
"skipLibCheck": true,
"strict": true,
"target": "es2021"
},
"exclude": ["node_modules"],
"include": [
Expand Down

0 comments on commit 7ab12fa

Please sign in to comment.