-
+
{
+ 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",