-
+
{item.title}
diff --git a/components/landing-page/opini.tsx b/components/landing-page/opini.tsx
index 0bd628f..1da7205 100644
--- a/components/landing-page/opini.tsx
+++ b/components/landing-page/opini.tsx
@@ -15,6 +15,7 @@ type Article = {
id: number;
title: string;
createdAt: string;
+ slug: string;
thumbnailUrl?: string;
categories: Category[];
};
@@ -52,7 +53,7 @@ function NewsColumn({ title, color, items }: NewsColumnProps) {
className={`flex flex-col ${
index === 0 ? "md:flex-row" : ""
} border-b border-gray-200 pb-3`}
- href={`/detail/${item?.id}`}
+ href={`/details/${item?.slug}`}
>
{index === 0 && item?.thumbnailUrl && (
diff --git a/components/landing-page/service.tsx b/components/landing-page/service.tsx
index db428ac..1496656 100644
--- a/components/landing-page/service.tsx
+++ b/components/landing-page/service.tsx
@@ -11,6 +11,7 @@ type Article = {
description: string;
categoryName: string;
createdAt: string;
+ slug: string;
createdByName: string;
thumbnailUrl: string;
categories: {
@@ -51,7 +52,7 @@ export default function HeadersService() {
return (
-
+
{others.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 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",