diff --git a/frontend/contexts/ReportDesignerContext.tsx b/frontend/contexts/ReportDesignerContext.tsx index 5c82c18a..8244cfd1 100644 --- a/frontend/contexts/ReportDesignerContext.tsx +++ b/frontend/contexts/ReportDesignerContext.tsx @@ -1426,14 +1426,36 @@ export function ReportDesignerProvider({ reportId, children }: { reportId: strin window.history.replaceState({}, "", `/admin/report/designer/${actualReportId}`); } - // 레이아웃 저장 (페이지 구조로) - await reportApi.saveLayout(actualReportId, { - layoutConfig, // 페이지 기반 구조 - queries: queries.map((q) => ({ - ...q, - externalConnectionId: q.externalConnectionId || undefined, - })), - }); + // 백엔드 호환성을 위해 첫 번째 페이지 정보를 레거시 필드로 변환 + const firstPage = layoutConfig.pages[0]; + const legacyFormat = firstPage + ? { + canvasWidth: firstPage.width, + canvasHeight: firstPage.height, + pageOrientation: firstPage.orientation, + components: firstPage.components, + margins: firstPage.margins, + // 새로운 페이지 기반 구조도 함께 전송 + layoutConfig, + queries: queries.map((q) => ({ + ...q, + externalConnectionId: q.externalConnectionId || undefined, + })), + } + : { + canvasWidth: 210, + canvasHeight: 297, + pageOrientation: "portrait" as const, + components: [], + layoutConfig, + queries: queries.map((q) => ({ + ...q, + externalConnectionId: q.externalConnectionId || undefined, + })), + }; + + // 레이아웃 저장 + await reportApi.saveLayout(actualReportId, legacyFormat); toast({ title: "성공",