aboutsummaryrefslogtreecommitdiffstats
path: root/src/services
diff options
context:
space:
mode:
authorArmand Philippot <git@armandphilippot.com>2021-12-17 17:58:03 +0100
committerArmand Philippot <git@armandphilippot.com>2021-12-17 17:58:03 +0100
commitabf6e96383035f99addab804e8c3dd1a74d36375 (patch)
tree066d672466495f948885379ac8fd7fb1228ad4cf /src/services
parent8a703cb39ff23ff3639b0da33f0d72f92f1cc55b (diff)
chore: display comments list on posts
Diffstat (limited to 'src/services')
-rw-r--r--src/services/graphql/post.ts5
1 files changed, 4 insertions, 1 deletions
diff --git a/src/services/graphql/post.ts b/src/services/graphql/post.ts
index 2ce918b..e827fd4 100644
--- a/src/services/graphql/post.ts
+++ b/src/services/graphql/post.ts
@@ -104,7 +104,10 @@ const fetchPostBySlug: FetchPostByReturn = async (slug: string) => {
export const getPostBySlug: GetPostByReturn = async (slug: string) => {
const rawPost = await fetchPostBySlug(slug);
- const comments = rawPost.postBy.comments.nodes;
+ const comments = rawPost.postBy.comments.nodes.reverse().map((comment) => {
+ const author = comment.author.node;
+ return { ...comment, author: author, replies: [] };
+ });
const content = rawPost.postBy.contentParts.afterMore;
const featuredImage = rawPost.postBy.featuredImage
? rawPost.postBy.featuredImage.node