diff --git a/app/details/[slug]/page.tsx b/app/details/[slug]/page.tsx
new file mode 100644
index 0000000..a509a5b
--- /dev/null
+++ b/app/details/[slug]/page.tsx
@@ -0,0 +1,19 @@
+import DetailContent from "@/components/details/details-content";
+import Footer from "@/components/landing-page/footer";
+import Navbar from "@/components/landing-page/navbar";
+import Image from "next/image";
+
+export default function Slug() {
+ return (
+
{articleDetail?.tags ? (
-
- {articleDetail.tags}
-
+ articleDetail.tags
+ .split(",") // pisahkan berdasarkan koma
+ .map((tag: string, index: number) => (
+
+ {tag.trim()}
+
+ ))
) : (
Tidak ada tag
)}
diff --git a/components/landing-page/breaking-news.tsx b/components/landing-page/breaking-news.tsx
index dc7ebc2..b4b0f12 100644
--- a/components/landing-page/breaking-news.tsx
+++ b/components/landing-page/breaking-news.tsx
@@ -13,6 +13,7 @@ type Article = {
title: string;
description: string;
categoryName: string;
+ slug: string;
createdAt: string;
createdByName: string;
thumbnailUrl: string;
@@ -123,7 +124,7 @@ export default function BreakingNews() {
{mainArticle && (
-
+
{/* LEFT - Image */}
@@ -227,7 +228,7 @@ export default function BreakingNews() {
return (
-
+
{/* Image */}
{/* LEFT - Image */}
@@ -382,7 +383,7 @@ export default function BreakingNews() {
0 && (
-
+
{/* Nomor Urut */}
diff --git a/components/landing-page/headers.tsx b/components/landing-page/headers.tsx
index ca3b99b..e2a78d1 100644
--- a/components/landing-page/headers.tsx
+++ b/components/landing-page/headers.tsx
@@ -12,6 +12,7 @@ type Article = {
title: string;
description: string;
categoryName: string;
+ slug: string;
createdAt: string;
createdByName: string;
thumbnailUrl: string;
@@ -73,7 +74,7 @@ export default function Header() {
key={article.id}
className="relative h-[438px] md:h-[438px] overflow-hidden"
>
-
+
{/* Background Image */}
{/* Item pertama tampil besar */}
-
+
0{i + 2}
diff --git a/components/table/article-table.tsx b/components/table/article-table.tsx
index d1a732c..3a50853 100644
--- a/components/table/article-table.tsx
+++ b/components/table/article-table.tsx
@@ -199,11 +199,11 @@ export default function ArticleTable() {
initState();
};
- const copyUrlArticle = async (id: number) => {
+ const copyUrlArticle = async (slug: any) => {
const url =
`${window.location.protocol}//${window.location.host}` +
- "/detail/" +
- `${id}`;
+ "/details/" +
+ `${slug}`;
try {
await navigator.clipboard.writeText(url);
successToast("Success", "Article Copy to Clipboard");
@@ -263,7 +263,9 @@ export default function ArticleTable() {
- copyUrlArticle(article.id)}>
+ copyUrlArticle(article.slug)}
+ >
Copy Url Article
diff --git a/service/article.ts b/service/article.ts
index 569cef0..4f338cd 100644
--- a/service/article.ts
+++ b/service/article.ts
@@ -106,6 +106,13 @@ export async function getArticleById(id: any) {
return await httpGet(`/articles/${id}`, headers);
}
+export async function getArticleBySlug(slug: any) {
+ const headers = {
+ "content-type": "application/json",
+ };
+ return await httpGet(`/articles/slug/${slug}`, headers);
+}
+
export async function deleteArticle(id: string) {
const headers = {
"content-type": "application/json",