READ MORE >
@@ -168,7 +169,7 @@ export default function HeaderPopular() {
Recent Posts
{recentPosts.map((post, index) => (
-
+
(
(
(
(
(
(
(
{/* Thumbnail */}
diff --git a/components/landing-page/on-the-spot.tsx b/components/landing-page/on-the-spot.tsx
index ac004b8..89b36f9 100644
--- a/components/landing-page/on-the-spot.tsx
+++ b/components/landing-page/on-the-spot.tsx
@@ -12,6 +12,7 @@ type Article = {
description: string;
categoryName: string;
createdAt: string;
+ slug: string;
createdByName: string;
customCreatorName: string;
thumbnailUrl: string;
@@ -114,7 +115,7 @@ export default function OnTheSpot() {
{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 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",