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
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));
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<number>(
(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({