"use client"; import React, { useEffect, useState } from "react"; import DetailNews from "../../page/detail-news"; import SidebarDetail from "../../page/sidebar-detail"; import RelatedNews from "../../page/related-news"; import Comment from "./comment"; import { getArticleById, getListArticle } from "@/service/article"; import { useParams } from "next/navigation"; import Link from "next/link"; import { ChevronRightIcon, UserIcon } from "@/components/icons"; import { close, loading } from "@/config/swal"; export default function NewsDetailPage() { const params = useParams(); const id: any = params?.id; const [detailArticle, setDetailArticle] = useState(); const [articles, setArticles] = useState([]); useEffect(() => { initFetch(); getArticles(); }, []); async function getArticles() { const req = { page: 1, search: "", limit: "50" }; const response = await getListArticle(req); setArticles(response?.data?.data); } const initFetch = async () => { loading(); const res = await getArticleById(id?.split("-")[0]); const data = res?.data?.data; setDetailArticle(data); close(); }; return (
Beranda

Berita

); }