// frontend/lib/journey/api.ts — GET /api/journey (작업·일정·사람 집계 read-model)
import type { Journey } from "@/lib/types";

async function ok<T>(r: Response): Promise<T> {
  if (!r.ok) throw new Error(`${r.status} ${r.statusText}`);
  return r.json() as Promise<T>;
}

export const journeyApi = {
  get: () => fetch("/api/journey", { cache: "no-store" }).then((r) => ok<Journey>(r)),
};
