diff --git a/.env b/.env index f6a8ebc..2ab7899 100644 --- a/.env +++ b/.env @@ -1,2 +1,2 @@ NETIDHUB_CLIENT_KEY=b1ce6602-07ad-46c2-85eb-0cd6decfefa3 -NEXT_PUBLIC_API_URL=http://kontenhumas.com/api \ No newline at end of file +NEXT_PUBLIC_API_URL=https://kontenhumas.com/api \ No newline at end of file diff --git a/components/landing-page/media-update.tsx b/components/landing-page/media-update.tsx index 1422b33..b9d5a6e 100644 --- a/components/landing-page/media-update.tsx +++ b/components/landing-page/media-update.tsx @@ -199,6 +199,16 @@ export default function MediaUpdate() { const typeId = parseInt(getTypeIdByContentType(contentType)); setCurrentTypeId(typeId.toString()); + // const response = await listArticles( + // 1, + // 10, + // typeId, + // undefined, + // undefined, + // section === "latest" ? "createdAt" : "viewCount", + // slug + // ); + const response = await listArticles( 1, 10, @@ -206,13 +216,13 @@ export default function MediaUpdate() { undefined, undefined, section === "latest" ? "createdAt" : "viewCount", - slug + slug || undefined, // ⬅️ jangan kirim undefined string ); let hasil: any[] = []; if (response?.error) { - console.error("Articles API failed, fallback ke old API"); + // console.error("Articles API failed, fallback ke old API"); const fallbackRes = await listData( typeId.toString(), "", @@ -221,7 +231,7 @@ export default function MediaUpdate() { 0, "", "", - "" + "", ); hasil = fallbackRes?.data?.data?.content || []; } else { @@ -263,14 +273,14 @@ export default function MediaUpdate() { const ids = new Set( (Array.isArray(bookmarks) ? bookmarks : []) .map((b: any) => Number(b.articleId ?? b.id ?? b.article?.id)) - .filter((x) => !isNaN(x)) + .filter((x) => !isNaN(x)), ); const gabungan = new Set([...localSet, ...ids]); setBookmarkedIds(gabungan); localStorage.setItem( "bookmarkedIds", - JSON.stringify(Array.from(gabungan)) + JSON.stringify(Array.from(gabungan)), ); } } catch (err) { @@ -308,7 +318,7 @@ export default function MediaUpdate() { setBookmarkedIds(updated); localStorage.setItem( "bookmarkedIds", - JSON.stringify(Array.from(updated)) + JSON.stringify(Array.from(updated)), ); MySwal.fire({