import type { Church } from "@crosscode/contracts"; import { API_BASE } from "@/lib/api"; /** * The church profile from the church's Accounts (3.7.0), through the backend's * `GET /api/v2/church`: the brand style for `` and the shared footer. null when Accounts * isn't connected or the backend can't be reached, and the pages look as they always have. * Fetched the same way as getServerSettings, so Next dedupes it within a request. */ export async function getServerChurch(): Promise { if (!API_BASE) return null; try { const res = await fetch(`${API_BASE}/api/v2/church`, { next: { revalidate: 60 } }); if (!res.ok) return null; return ((await res.json())?.data as Church | null) ?? null; } catch { return null; } }