/** * 从服务端 API 获取公开数据 * * 用法: * const { data: brand } = await usePublicApi('brand') * const { data: faq } = await usePublicApi('faq') * * 数据来源:GET /api/content/[key] → site_content 表 * * SSR 首屏:服务端调 API,数据嵌入 HTML(SEO 友好) * 客户端导航:浏览器直接调 /api/content/[key](Network 可见) */ export function usePublicApi(endpoint, options = {}) { return useFetch(`/api/content/${endpoint}`, { key: `public-${endpoint}`, // 客户端导航时重新请求接口,不使用 payload 缓存 getCachedData: () => undefined, ...options, }) }