From 1df9197c5bcd113b5482cc7690f869c5b6861985 Mon Sep 17 00:00:00 2001 From: Rama Priyanto Date: Thu, 22 Jan 2026 11:05:51 +0700 Subject: [PATCH] fix:detail article suggest article --- components/main/detail/list-news.tsx | 1 + components/page/sidebar-detail.tsx | 14 +++++++++++--- services/article.ts | 3 ++- 3 files changed, 14 insertions(+), 4 deletions(-) diff --git a/components/main/detail/list-news.tsx b/components/main/detail/list-news.tsx index 23ee6f5..62d5466 100644 --- a/components/main/detail/list-news.tsx +++ b/components/main/detail/list-news.tsx @@ -259,6 +259,7 @@ export default function ListNews() { usedMonth && usedYear ? convertDateFormatNoTimeV2(new Date(usedYear, usedMonth, 0)) : "", + timeStamp: getUnixTimestamp(), }; const response = await getListArticle(req); diff --git a/components/page/sidebar-detail.tsx b/components/page/sidebar-detail.tsx index 38e4ee1..a7fbd61 100644 --- a/components/page/sidebar-detail.tsx +++ b/components/page/sidebar-detail.tsx @@ -9,7 +9,11 @@ import "swiper/css/pagination"; import Link from "next/link"; import { getListArticle } from "@/services/article"; import { Card, CardFooter, Skeleton } from "@heroui/react"; -import { convertDateFormat, textEllipsis } from "@/utils/global"; +import { + convertDateFormat, + getUnixTimestamp, + textEllipsis, +} from "@/utils/global"; import Image from "next/image"; export default function SidebarDetail() { @@ -27,7 +31,9 @@ export default function SidebarDetail() { search: "", limit: "10", isPublish: true, - category: "781,802", + sort: "desc", + categoryIds: "791,802", + timeStamp: getUnixTimestamp(), }; const response = await getListArticle(req); @@ -35,12 +41,14 @@ export default function SidebarDetail() { } async function getArticlePolda() { + console.log("jalan"); const req = { page: 1, search: "", limit: "10", + sort: "desc", isPublish: true, - isPolda: true, + timeStamp: getUnixTimestamp(), }; const response = await getListArticle(req); diff --git a/services/article.ts b/services/article.ts index c8e9736..ed7be60 100644 --- a/services/article.ts +++ b/services/article.ts @@ -24,6 +24,7 @@ export async function getListArticle(props: PaginationRequest) { categoryIds, createdByIds, isPolda, + timeStamp, } = props; const headers = { "content-type": "application/json", @@ -37,7 +38,7 @@ export async function getListArticle(props: PaginationRequest) { sort || "desc" }&category=${categorySlug || ""}&isBanner=${isBanner || ""}&categoryIds=${ categoryIds || "" - }&createdByIds=${createdByIds || ""}&isPolda=${isPolda || ""}`, + }&createdByIds=${createdByIds || ""}&isPolda=${isPolda || ""}&timeStamp=${timeStamp || ""}`, headers, ); }