diff options
| author | Armand Philippot <git@armandphilippot.com> | 2021-12-17 19:21:11 +0100 |
|---|---|---|
| committer | Armand Philippot <git@armandphilippot.com> | 2021-12-17 19:21:11 +0100 |
| commit | 37bc9d25deecb04b7970881d46551d5b33fe88df (patch) | |
| tree | 44e03f3ab883164c3916a606521b07461c05e40d /src/services | |
| parent | cf195f8c6b4195423dd257a99afb904673d87d25 (diff) | |
chore: add meta to single posts
Diffstat (limited to 'src/services')
| -rw-r--r-- | src/services/graphql/post.ts | 9 |
1 files changed, 9 insertions, 0 deletions
diff --git a/src/services/graphql/post.ts b/src/services/graphql/post.ts index e827fd4..cc6232a 100644 --- a/src/services/graphql/post.ts +++ b/src/services/graphql/post.ts @@ -35,6 +35,13 @@ const fetchPostBySlug: FetchPostByReturn = async (slug: string) => { } } } + author { + node { + firstName + lastName + name + } + } commentCount comments { nodes { @@ -104,6 +111,7 @@ const fetchPostBySlug: FetchPostByReturn = async (slug: string) => { export const getPostBySlug: GetPostByReturn = async (slug: string) => { const rawPost = await fetchPostBySlug(slug); + const author = rawPost.postBy.author.node; const comments = rawPost.postBy.comments.nodes.reverse().map((comment) => { const author = comment.author.node; return { ...comment, author: author, replies: [] }; @@ -126,6 +134,7 @@ export const getPostBySlug: GetPostByReturn = async (slug: string) => { const formattedPost: Article = { ...rawPost.postBy, + author, comments, content, featuredImage, |
