From c4a2d4e45803a8bba83983063c02b0eb3c91c6b4 Mon Sep 17 00:00:00 2001 From: Kuesung Park Date: Thu, 1 Feb 2024 15:55:01 +0900 Subject: [PATCH] feat : if slug is empty, use id --- src/libs/utils/notion/filterPosts.ts | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/src/libs/utils/notion/filterPosts.ts b/src/libs/utils/notion/filterPosts.ts index f13d200ac..49bb5f97f 100644 --- a/src/libs/utils/notion/filterPosts.ts +++ b/src/libs/utils/notion/filterPosts.ts @@ -23,7 +23,7 @@ export function filterPosts( // filter data .filter((post) => { const postDate = new Date(post?.date?.start_date || post.createdTime) - if (!post.title || !post.slug || postDate > tomorrow) return false + if (!post.title || postDate > tomorrow) return false return true }) // filter status @@ -36,5 +36,9 @@ export function filterPosts( const postType = post.type[0] return acceptType.includes(postType) }) + .map((post) => { + if (!post.slug) post.slug = post.id; + return post; + }) return filteredPosts }