diff --git a/src/hooks/usePlan.js b/src/hooks/usePlan.js index 0bc2a5d5..f812f00e 100644 --- a/src/hooks/usePlan.js +++ b/src/hooks/usePlan.js @@ -449,26 +449,26 @@ export function usePlan(params = {}) { if (currentCanvasPlan?.id) { await saveCanvas(false) } - JSON.parse(currentCanvasData()).objects.length > 0 - ? swalFire({ - text: `Plan ${currentCanvasPlan.planNo} ` + getMessage('plan.message.confirm.copy'), - type: 'confirm', - confirmFn: async () => { - setIsGlobalLoading(true) - await postObjectPlan(userId, objectNo, true, false) - setIsGlobalLoading(false) - }, - denyFn: async () => { - setIsGlobalLoading(true) - await postObjectPlan(userId, objectNo, false, false) - setIsGlobalLoading(false) - }, - }) - : async () => { + if (JSON.parse(currentCanvasData()).objects.length > 0) { + swalFire({ + text: `Plan ${currentCanvasPlan.planNo} ` + getMessage('plan.message.confirm.copy'), + type: 'confirm', + confirmFn: async () => { + setIsGlobalLoading(true) + await postObjectPlan(userId, objectNo, true, false) + setIsGlobalLoading(false) + }, + denyFn: async () => { setIsGlobalLoading(true) await postObjectPlan(userId, objectNo, false, false) setIsGlobalLoading(false) - } + }, + }) + } else { + setIsGlobalLoading(true) + await postObjectPlan(userId, objectNo, false, false) + setIsGlobalLoading(false) + } } /**