bug: fix show featured blogs

This commit is contained in:
Quangnhankie
2021-10-20 10:56:34 +07:00
parent 7ea734d0ad
commit 5b5aeec0d2
4 changed files with 31 additions and 12 deletions

View File

@@ -22,7 +22,12 @@ const BlogsList = ({ blogList,total,idFeatured }:BlogsListProps) => {
const DEFAULT_BLOGS_ARGS = {
excludeBlogIds: [idFeatured],
options:{
skip: 1, take: DEFAULT_BLOG_PAGE_SIZE
take: DEFAULT_BLOG_PAGE_SIZE,
filter: {
isFeatured: {
eq:false
}
}
}
}
@@ -34,6 +39,7 @@ const BlogsList = ({ blogList,total,idFeatured }:BlogsListProps) => {
const onPageChange = (page:number) => {
router.push({
pathname: ROUTE.BLOGS,
@@ -65,7 +71,6 @@ const BlogsList = ({ blogList,total,idFeatured }:BlogsListProps) => {
data = blogs
}
return (
<section>
<div className={s.wrapper}>
@@ -73,10 +78,10 @@ const BlogsList = ({ blogList,total,idFeatured }:BlogsListProps) => {
<div className={s.list}>
{
data?.map((product,index)=> {
data?.map((blog,index)=> {
return(
<div className={s.card} key={`${product.title}-${index}`}>
{product.isPublish && <CardBlog {...product} /> }
<div className={s.card} key={`${blog.title}-${index}`}>
{blog.isPublish && !blog.isFeatured && <CardBlog {...blog} /> }
</div>
)
})