fix: filtering works now
Fix wrong filtering
This commit is contained in:
parent
2466e7dc89
commit
85d2ad60a2
1 changed files with 8 additions and 1 deletions
|
@ -62,7 +62,14 @@ const externalPosts = computed<BlogCard[]>(() => externalPostsRaw.value?.flatMap
|
|||
}))
|
||||
}) ?? [])
|
||||
|
||||
const allPosts = computed<BlogCard[]>(() => [...(firstTen.value ?? []), ...(externalPosts.value ?? [])].sort((a, b) => new Date(b.date).getTime() - new Date(a.date).getTime()))
|
||||
const allPosts = computed<BlogCard[]>(() => {
|
||||
const allPosts = [...firstTen.value, ...externalPosts.value]
|
||||
allPosts.sort((a, b) => new Date(b.date).getTime() - new Date(a.date).getTime())
|
||||
if (route.query.category && Object.keys(allCategoriesAndCount.value).includes(route.query.category as Category)) {
|
||||
return allPosts.filter(article => article.category === route.query.category)
|
||||
}
|
||||
return allPosts
|
||||
})
|
||||
|
||||
const allCategoriesAndCount = computed<Record<Category, number>>(() => {
|
||||
const categories = {} as Record<Category, number>
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue