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