Skip to content

Commit

Permalink
feat : if slug is empty, use id
Browse files Browse the repository at this point in the history
  • Loading branch information
guesung committed Feb 1, 2024
1 parent 37b3bda commit c4a2d4e
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion src/libs/utils/notion/filterPosts.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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
}

0 comments on commit c4a2d4e

Please sign in to comment.