You cannot select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

22 lines
799 B
TypeScript

// frontend/lib/dashboard/api.ts
import type { Dashboard } from "@/lib/types";
const BASE = process.env.NEXT_PUBLIC_API_BASE ?? "http://localhost:31800";
export async function getDashboard(signal?: AbortSignal): Promise<Dashboard> {
const res = await fetch(`${BASE}/api/dashboard`, { signal, cache: "no-store" });
if (!res.ok) throw new Error(`dashboard ${res.status}`);
return res.json();
}
/** 자연어 명령 → 인박스 캡처 (phase-4와 동일 엔드포인트) */
export async function captureCommand(raw: string) {
const res = await fetch(`${BASE}/api/inbox/capture`, {
method: "POST",
headers: { "Content-Type": "application/json" },
body: JSON.stringify({ kind: "text", raw }),
});
if (!res.ok) throw new Error(`capture ${res.status}`);
return res.json();
}