From 37bc9d25deecb04b7970881d46551d5b33fe88df Mon Sep 17 00:00:00 2001 From: Armand Philippot Date: Fri, 17 Dec 2021 19:21:11 +0100 Subject: chore: add meta to single posts --- src/services/graphql/post.ts | 9 +++++++++ 1 file changed, 9 insertions(+) (limited to 'src/services') 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, -- cgit v1.2.3