Spaces:
Sleeping
Sleeping
Caner Giden commited on
Refactor health check fetching in Home component
Browse files12345678910111213141516171819202122232425262728async function fetchHealth() {const base = process.env.NEXT_PUBLIC_API_BASE;if (!base) return { error: "NEXT_PUBLIC_API_BASE missing" };try {const res = await fetch(`${base}/health`, { cache: "no-store" });const data = await res.json();return data;} catch (e: any) {return { error: e?.message ?? "fetch failed" };}}export default async function Home() {const health = await fetchHealth();return (<main style={{ padding: 24 }}><h1>ForgeFlow Studio</h1><p>Core health check:</p><pre style={{ background: "#111", color: "#0f0", padding: 16, borderRadius: 8 }}>{JSON.stringify(health, null, 2)}</pre><p>Eğer burada <code>db_ok: true</code> görüyorsan Studio → Core bağlantısı tamam.</p></main>);1234567891011121314151617181920212223242526272829303132333435export default async function Home() {let health: any;try {const res = await fetch("http://localhost:7860/api/core/health", {cache: "no-store",});health = await res.json();} catch (e: any) {health = { error: e?.message ?? "fetch failed" };}return (<main style={{ padding: 24 }}><h1>ForgeFlow Studio</h1><p>Core health check:</p><prestyle={{background: "#111",color: "#0f0",padding: 16,borderRadius: 8,}}>{JSON.stringify(health, null, 2)}</pre><p>Eğer burada <code>db_ok: true</code> görüyorsan Studio → Core bağlantısıtamam.</p></main>);
app/page.tsx+20-13