"use client"; import { useEffect, useState } from "react"; import Image from "next/image"; import Link from "next/link"; import { Calendar } from "lucide-react"; import { getListArticle } from "@/service/article"; // Definisi type type Article = { id: number; title: string; description: string; categoryName: string; createdAt: string; createdByName: string; thumbnailUrl: string; categories: { title: string }[]; files: { file_url: string; file_alt: string }[]; }; export default function Footer() { const [articles, setArticles] = useState([]); const [loading, setLoading] = useState(true); useEffect(() => { fetchArticles(); }, []); async function fetchArticles() { try { const req = { limit: "2", // ambil 2 berita untuk recent news page: 1, search: "", categorySlug: "", sort: "desc", isPublish: true, sortBy: "created_at", }; const res = await getListArticle(req); setArticles(res?.data?.data || []); } catch (error) { console.error("Gagal memuat artikel:", error); } finally { setLoading(false); } } return ( ); }