'use client' import { useState, useEffect } from 'react' export interface CmsItem { id: string slug: string data: Record publishedAt: string | null } export function useEmDashContent(collection: string) { const [items, setItems] = useState([]) const [loading, setLoading] = useState(true) useEffect(() => { fetch(`/api/emdash/${collection}`) .then(r => r.json()) .then((data: { items?: CmsItem[] }) => { setItems(data.items ?? []) setLoading(false) }) .catch(() => setLoading(false)) }, [collection]) return { items, loading } }