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/citizen-news/citizen-news.tsx b/components/landing-page/citizen-news/citizen-news.tsx
index 424fc1d..b06e523 100644
--- a/components/landing-page/citizen-news/citizen-news.tsx
+++ b/components/landing-page/citizen-news/citizen-news.tsx
@@ -12,6 +12,7 @@ type Article = {
description: string;
categoryName: string;
createdAt: string;
+ slug: string;
createdByName: string;
customCreatorName: string;
thumbnailUrl: string;
@@ -149,7 +150,7 @@ export default function CitizenNews() {
{/* Image + Category */}
@@ -318,7 +319,7 @@ export default function CitizenNews() {
-
+
{mainArticle && (
-
+
{otherArticles.map((article, index) => (
-
+
-
+
{leftList.map((item) => (
-
+
-
+
{centerList.map((item) => (
-
+
-
+
{rightList.map((item) => (
-
+
{/* Image + Category */}
@@ -317,7 +318,7 @@ export default function DevelopmentNews() {
-
+
{mainArticle && (
-
+
{otherArticles.map((article, index) => (
-
+
0 ? (
articles.map((item, index) => (
-
+
-
+
{leftList.map((item) => (
-
+
-
+
{centerList.map((item) => (
-
+
-
+
{rightList.map((item) => (
-
+
{mainArticle && (
-
+
{otherArticles.map((article, index) => (
-
+
-
+
0 ? (
articles.map((item) => (
-
+
{
+ 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 d45df5a..6c0ec10 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",