fix: .env

This commit is contained in:
Sabda Yagra 2026-01-19 16:38:08 +07:00
parent 1dfb8d49a9
commit 26b2f51787
2 changed files with 17 additions and 7 deletions

2
.env
View File

@ -1,2 +1,2 @@
NETIDHUB_CLIENT_KEY=b1ce6602-07ad-46c2-85eb-0cd6decfefa3 NETIDHUB_CLIENT_KEY=b1ce6602-07ad-46c2-85eb-0cd6decfefa3
NEXT_PUBLIC_API_URL=http://kontenhumas.com/api NEXT_PUBLIC_API_URL=https://kontenhumas.com/api

View File

@ -199,6 +199,16 @@ export default function MediaUpdate() {
const typeId = parseInt(getTypeIdByContentType(contentType)); const typeId = parseInt(getTypeIdByContentType(contentType));
setCurrentTypeId(typeId.toString()); setCurrentTypeId(typeId.toString());
// const response = await listArticles(
// 1,
// 10,
// typeId,
// undefined,
// undefined,
// section === "latest" ? "createdAt" : "viewCount",
// slug
// );
const response = await listArticles( const response = await listArticles(
1, 1,
10, 10,
@ -206,13 +216,13 @@ export default function MediaUpdate() {
undefined, undefined,
undefined, undefined,
section === "latest" ? "createdAt" : "viewCount", section === "latest" ? "createdAt" : "viewCount",
slug slug || undefined, // ⬅️ jangan kirim undefined string
); );
let hasil: any[] = []; let hasil: any[] = [];
if (response?.error) { 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( const fallbackRes = await listData(
typeId.toString(), typeId.toString(),
"", "",
@ -221,7 +231,7 @@ export default function MediaUpdate() {
0, 0,
"", "",
"", "",
"" "",
); );
hasil = fallbackRes?.data?.data?.content || []; hasil = fallbackRes?.data?.data?.content || [];
} else { } else {
@ -263,14 +273,14 @@ export default function MediaUpdate() {
const ids = new Set<number>( const ids = new Set<number>(
(Array.isArray(bookmarks) ? bookmarks : []) (Array.isArray(bookmarks) ? bookmarks : [])
.map((b: any) => Number(b.articleId ?? b.id ?? b.article?.id)) .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]); const gabungan = new Set([...localSet, ...ids]);
setBookmarkedIds(gabungan); setBookmarkedIds(gabungan);
localStorage.setItem( localStorage.setItem(
"bookmarkedIds", "bookmarkedIds",
JSON.stringify(Array.from(gabungan)) JSON.stringify(Array.from(gabungan)),
); );
} }
} catch (err) { } catch (err) {
@ -308,7 +318,7 @@ export default function MediaUpdate() {
setBookmarkedIds(updated); setBookmarkedIds(updated);
localStorage.setItem( localStorage.setItem(
"bookmarkedIds", "bookmarkedIds",
JSON.stringify(Array.from(updated)) JSON.stringify(Array.from(updated)),
); );
MySwal.fire({ MySwal.fire({