restapi 버튼 동작

This commit is contained in:
kjs
2025-09-29 12:17:10 +09:00
parent cedb5e3ec3
commit c9afdec09f
19 changed files with 1910 additions and 81 deletions

View File

@@ -622,7 +622,57 @@ const DataConnectionDesigner: React.FC<DataConnectionDesignerProps> = ({
company_code: "*", // 기본값
};
const configResult = await ExternalCallConfigAPI.createConfig(configData);
let configResult;
if (diagramId) {
// 수정 모드: 기존 설정이 있는지 확인하고 업데이트 또는 생성
console.log("🔄 수정 모드 - 외부호출 설정 처리");
try {
// 먼저 기존 설정 조회 시도
const existingConfigs = await ExternalCallConfigAPI.getConfigs({
company_code: "*",
is_active: "Y",
});
const existingConfig = existingConfigs.data?.find(
(config: any) => config.config_name === (state.relationshipName || "외부호출 설정")
);
if (existingConfig) {
// 기존 설정 업데이트
console.log("📝 기존 외부호출 설정 업데이트:", existingConfig.id);
configResult = await ExternalCallConfigAPI.updateConfig(existingConfig.id, configData);
} else {
// 기존 설정이 없으면 새로 생성
console.log("🆕 새 외부호출 설정 생성 (수정 모드)");
configResult = await ExternalCallConfigAPI.createConfig(configData);
}
} catch (updateError) {
// 중복 생성 오류인 경우 무시하고 계속 진행
if (updateError.message && updateError.message.includes("이미 존재합니다")) {
console.log("⚠️ 외부호출 설정이 이미 존재함 - 기존 설정 사용");
configResult = { success: true, message: "기존 외부호출 설정 사용" };
} else {
console.warn("⚠️ 외부호출 설정 처리 실패:", updateError);
throw updateError;
}
}
} else {
// 신규 생성 모드
console.log("🆕 신규 생성 모드 - 외부호출 설정 생성");
try {
configResult = await ExternalCallConfigAPI.createConfig(configData);
} catch (createError) {
// 중복 생성 오류인 경우 무시하고 계속 진행
if (createError.message && createError.message.includes("이미 존재합니다")) {
console.log("⚠️ 외부호출 설정이 이미 존재함 - 기존 설정 사용");
configResult = { success: true, message: "기존 외부호출 설정 사용" };
} else {
throw createError;
}
}
}
if (!configResult.success) {
throw new Error(configResult.error || "외부호출 설정 저장 실패");