summaryrefslogtreecommitdiffstats
path: root/src/services
diff options
context:
space:
mode:
authorArmand Philippot <git@armandphilippot.com>2021-12-16 18:22:08 +0100
committerArmand Philippot <git@armandphilippot.com>2021-12-16 18:22:08 +0100
commit0ef4f77954ba54b52b96c70a8bffe96804bd222d (patch)
tree7fe68b05271625f72f750786e1a94b71942d2cd5 /src/services
parenta4f865224e0e395c7e29bb3b7279a5101b554d2c (diff)
chore: display featuredImage and meta on posts list
Diffstat (limited to 'src/services')
-rw-r--r--src/services/graphql/blog.ts3
-rw-r--r--src/services/graphql/post.ts6
2 files changed, 6 insertions, 3 deletions
diff --git a/src/services/graphql/blog.ts b/src/services/graphql/blog.ts
index 6b92b5a..27b972b 100644
--- a/src/services/graphql/blog.ts
+++ b/src/services/graphql/blog.ts
@@ -99,12 +99,14 @@ export const getPublishedPosts: GetPostsListReturn = async ({
contentParts,
databaseId,
date,
+ featuredImage,
id,
modified,
slug,
title,
} = post.node;
const content = contentParts.beforeMore;
+ const cover = featuredImage ? featuredImage.node : null;
const dates = { publication: date, update: modified };
const subjects =
acfPosts.postsInSubject && acfPosts.postsInSubject?.length > 0
@@ -120,6 +122,7 @@ export const getPublishedPosts: GetPostsListReturn = async ({
content,
databaseId,
date: dates,
+ featuredImage: cover,
id,
slug,
subjects,
diff --git a/src/services/graphql/post.ts b/src/services/graphql/post.ts
index c7144fc..2ce918b 100644
--- a/src/services/graphql/post.ts
+++ b/src/services/graphql/post.ts
@@ -108,7 +108,7 @@ export const getPostBySlug: GetPostByReturn = async (slug: string) => {
const content = rawPost.postBy.contentParts.afterMore;
const featuredImage = rawPost.postBy.featuredImage
? rawPost.postBy.featuredImage.node
- : {};
+ : null;
const date = {
publication: rawPost.postBy.date,
update: rawPost.postBy.modified,
@@ -117,8 +117,8 @@ export const getPostBySlug: GetPostByReturn = async (slug: string) => {
const subjects = rawPost.postBy.acfPosts.postsInSubject
? rawPost.postBy.acfPosts.postsInSubject
: [];
- const thematics = rawPost.postBy.acfPosts.postsInThematics
- ? rawPost.postBy.acfPosts.postsInThematics
+ const thematics = rawPost.postBy.acfPosts.postsInThematic
+ ? rawPost.postBy.acfPosts.postsInThematic
: [];
const formattedPost: Article = {