From 34e216546151eaf8a0a3cbb0bc8b65dae4c63bf2 Mon Sep 17 00:00:00 2001 From: Armand Philippot Date: Mon, 23 May 2022 14:07:02 +0200 Subject: refactor: reduce the number of data transformation --- src/services/graphql/articles.ts | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) (limited to 'src/services/graphql/articles.ts') diff --git a/src/services/graphql/articles.ts b/src/services/graphql/articles.ts index f130872..f0ba4e4 100644 --- a/src/services/graphql/articles.ts +++ b/src/services/graphql/articles.ts @@ -71,13 +71,12 @@ export const getArticleFromRawData = (data: RawArticle): Article => { id: databaseId, intro: contentParts.beforeMore, meta: { - author: getAuthorFromRawData(author.node, 'page'), + author: author && getAuthorFromRawData(author.node, 'page'), commentsCount: commentCount || 0, cover: featuredImage?.node ? getImageFromRawData(featuredImage.node) : undefined, dates: { publication: date, update: modified }, - readingTime: info.readingTime, seo: { description: seo?.metaDesc || '', title: seo?.title || '', -- cgit v1.2.3