📌 feat: Implement usePlan hook for managing floor plan state and interactions, including canvas data handling, plan creation, deletion, and context management.

This commit is contained in:
yoosangwook 2025-03-27 10:33:34 +09:00
parent e293d5dfde
commit 2473cfac17

View File

@ -52,6 +52,9 @@ export function usePlan(params = {}) {
const { fetchBasicSettings, basicSettingCopySave } = useCanvasSetting() const { fetchBasicSettings, basicSettingCopySave } = useCanvasSetting()
const [canvasSetting, setCanvasSetting] = useRecoilState(canvasSettingState) const [canvasSetting, setCanvasSetting] = useRecoilState(canvasSettingState)
/** 전역 로딩바 컨텍스트 */
const { setIsGlobalLoading } = useContext(QcastContext)
/** /**
* 플랜 복사 모듈이 있을경우 모듈 데이터 복사하기 위한 처리 * 플랜 복사 모듈이 있을경우 모듈 데이터 복사하기 위한 처리
*/ */
@ -450,13 +453,21 @@ export function usePlan(params = {}) {
text: `Plan ${currentCanvasPlan.planNo} ` + getMessage('plan.message.confirm.copy'), text: `Plan ${currentCanvasPlan.planNo} ` + getMessage('plan.message.confirm.copy'),
type: 'confirm', type: 'confirm',
confirmFn: async () => { confirmFn: async () => {
setIsGlobalLoading(true)
await postObjectPlan(userId, objectNo, true, false) await postObjectPlan(userId, objectNo, true, false)
setIsGlobalLoading(false)
}, },
denyFn: async () => { denyFn: async () => {
setIsGlobalLoading(true)
await postObjectPlan(userId, objectNo, false, false) await postObjectPlan(userId, objectNo, false, false)
setIsGlobalLoading(false)
}, },
}) })
: await postObjectPlan(userId, objectNo, false, false) : async () => {
setIsGlobalLoading(true)
await postObjectPlan(userId, objectNo, false, false)
setIsGlobalLoading(false)
}
} }
/** /**