요소 추가 버튼 시 api 호출 삭제

This commit is contained in:
dohyeons
2025-10-20 10:06:17 +09:00
parent aba6283e3f
commit ab07908f09
2 changed files with 11 additions and 9 deletions

View File

@@ -70,16 +70,22 @@ export default function YardEditor({ layout, onBack }: YardEditorProps) {
color: "#9ca3af", // 회색 (미설정 상태)
};
console.log("요소 추가 요청:", { layoutId: layout.id, data: newPlacementData });
const response = await yardLayoutApi.addMaterialPlacement(layout.id, newPlacementData);
console.log("요소 추가 응답:", response);
if (response.success) {
const newPlacement = response.data as YardPlacement;
setPlacements((prev) => [...prev, newPlacement]);
setSelectedPlacement(newPlacement);
setShowConfigPanel(true); // 자동으로 설정 패널 표시
} else {
console.error("요소 추가 실패 (응답):", response);
setError(response.message || "요소 추가에 실패했습니다.");
}
} catch (error) {
console.error("요소 추가 실패:", error);
setError("요소 추가에 실패했습니다.");
console.error("요소 추가 실패 (예외):", error);
setError(`요소 추가에 실패했습니다: ${error instanceof Error ? error.message : String(error)}`);
}
};