import { useQuery } from '@tanstack/react-query' import { Link } from '@tanstack/react-router' import * as api from '@/lib/api' import { SocialShareButtons } from '@/components/features/social-share' export function ArchiveComponent() { const { data, isLoading, error } = useQuery({ queryKey: ['articles'], queryFn: () => api.fetchArticles({ status: 'published' }), }) if (isLoading) { return (
Loading articles...
) } if (error) { return (
Error loading articles
) } return (

Articles

Latest news and articles

{data?.data.map((article) => (

{article.title}

{article.excerpt && (

{article.excerpt}

)}
{new Date(article.createdAt).toLocaleDateString('mk-MK', { day: 'numeric', month: 'short', year: 'numeric', })} {article.views} views
))}
{data?.data.length === 0 && (

No articles published yet. Check back soon!

)}
) }