// frontend/lib/weekly/api.ts — 주간 리뷰 조회
import type { WeeklyReview } from "@/lib/types";

const BASE = process.env.NEXT_PUBLIC_API_BASE ?? "http://localhost:31800";

export async function getWeeklyReview(
  week?: string,
  signal?: AbortSignal,
): Promise<WeeklyReview> {
  const qs = week ? `?week=${encodeURIComponent(week)}` : "";
  const res = await fetch(`${BASE}/api/weekly-review${qs}`, { signal, cache: "no-store" });
  if (!res.ok) throw new Error(`weekly-review ${res.status}`);
  return res.json();
}
