diff --git a/src/hooks/usePlan.js b/src/hooks/usePlan.js index f812f00e..74c03296 100644 --- a/src/hooks/usePlan.js +++ b/src/hooks/usePlan.js @@ -21,6 +21,7 @@ import { moduleSelectionDataState, selectedModuleState } from '@/store/selectedM import { useCanvasPopupStatusController } from './common/useCanvasPopupStatusController' import { useCanvasMenu } from './common/useCanvasMenu' import { QcastContext } from '@/app/QcastProvider' +import { unescapeString } from '@/util/common-utils' /** * 플랜 처리 훅 @@ -264,7 +265,7 @@ export function usePlan(params = {}) { objectNo, planNo: parseInt(newPlan.planNo), popupType: 1, - popupStatus: sourceDegree.popupStatus, + popupStatus: unescapeString(sourceDegree.popupStatus), } console.log('🚀 ~ postObjectPlan ~ degreeData:', degreeData) await post({ url: `/api/v1/canvas-popup-status`, data: degreeData }) diff --git a/src/util/common-utils.js b/src/util/common-utils.js index 842eace0..0a1265fe 100644 --- a/src/util/common-utils.js +++ b/src/util/common-utils.js @@ -145,9 +145,19 @@ export const unescapeString = (str) => { ''': "'", } + /* + 1. 한번 변환은 {" 로 변환됨 : 에러 발생 => while 변경 + 2. 변환할 내용이 없으면 리턴값이 undefined + if (regex.test(str)) { return str.replace(regex, (matched) => chars[matched] || matched) } + */ + + while (regex.test(str)) { + str = str.replace(regex, (matched) => chars[matched] || matched); + } + return str } export const isNullOrUndefined = (value) => {