Skip to content

Commit

Permalink
fix: broken slug types
Browse files Browse the repository at this point in the history
  • Loading branch information
Pierniki committed Sep 11, 2023
1 parent 3f5fb1b commit 4dc4cd0
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 2 deletions.
3 changes: 2 additions & 1 deletion src/app/[lang]/article/[slug]/page.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,8 @@ type ArticlePageProps = { params: { lang: Locale; slug: string } }

export async function generateMetadata({ params: { lang, slug } }: ArticlePageProps): Promise<Metadata | null> {
const { getArticleSummary } = HygraphClient(lang)
const { article } = await getArticleSummary({ slug })
const { articles } = await getArticleSummary({ slug })
const article = articles[0]

if (!article) return null
return {
Expand Down
2 changes: 1 addition & 1 deletion src/hygraphClient.ts
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ const getArticles = graphql(`

const getArticleSummary = graphql(`
query getArticleSummary($locales: [Locale!]!, $slug: String!) {
article(locales: $locales, where: { slug: $slug }) {
articles(locales: $locales, where: { slug: $slug }) {
id
title
coverImage {
Expand Down

0 comments on commit 4dc4cd0

Please sign in to comment.