From 31bf7529701a1ca87e4ee72b836e2acc9fb9c2d0 Mon Sep 17 00:00:00 2001 From: ysCha Date: Wed, 4 Jun 2025 19:17:53 +0900 Subject: [PATCH] selectedPlan?.planNo?? currentPid or pid --- src/components/estimate/Estimate.jsx | 2 +- src/components/floor-plan/CanvasMenu.jsx | 8 ++++---- src/components/simulator/Simulator.jsx | 2 +- 3 files changed, 6 insertions(+), 6 deletions(-) diff --git a/src/components/estimate/Estimate.jsx b/src/components/estimate/Estimate.jsx index 9a60fd0e..e59dd9ff 100644 --- a/src/components/estimate/Estimate.jsx +++ b/src/components/estimate/Estimate.jsx @@ -154,7 +154,7 @@ export default function Estimate({}) { useEffect(() => { // console.log('🚀 ~ Estimate ~ selectedPlan:', selectedPlan) - if (selectedPlan) initEstimate(selectedPlan.planNo) + if (selectedPlan) initEstimate(selectedPlan?.planNo?? currentPid) }, [selectedPlan]) useEffect(() => { diff --git a/src/components/floor-plan/CanvasMenu.jsx b/src/components/floor-plan/CanvasMenu.jsx index 5d2d1030..b876d517 100644 --- a/src/components/floor-plan/CanvasMenu.jsx +++ b/src/components/floor-plan/CanvasMenu.jsx @@ -241,7 +241,7 @@ export default function CanvasMenu(props) { return } setIsGlobalLoading(true) - promiseGet({ url: `/api/estimate/${objectNo}/${selectedPlan.planNo}/detail` }).then((res) => { + promiseGet({ url: `/api/estimate/${objectNo}/${selectedPlan?.planNo??pid}/detail` }).then((res) => { if (res.status === 200) { const estimateDetail = res.data if (estimateDetail.estimateDate !== null) { @@ -249,7 +249,7 @@ export default function CanvasMenu(props) { setCurrentMenu(menu.title) setFloorPlanObjectNo({ floorPlanObjectNo: objectNo }) setIsGlobalLoading(false) - router.push(`/floor-plan/estimate/5?pid=${selectedPlan.planNo}&objectNo=${objectNo}`) + router.push(`/floor-plan/estimate/5?pid=${selectedPlan?.planNo??pid}&objectNo=${objectNo}`) if (pathname === '/floor-plan/estimate/5') { setIsGlobalLoading(false) } @@ -262,13 +262,13 @@ export default function CanvasMenu(props) { break case 'simulation': setIsGlobalLoading(true) - promiseGet({ url: `/api/estimate/${objectNo}/${selectedPlan.planNo}/detail` }).then((res) => { + promiseGet({ url: `/api/estimate/${objectNo}/${selectedPlan?.planNo??pid}/detail` }).then((res) => { if (res.status === 200) { const estimateDetail = res.data if (estimateDetail.estimateDate !== null && estimateDetail.docNo) { setSelectedMenu(menu.type) setCurrentMenu(menu.title) - router.push(`/floor-plan/simulator/6?pid=${selectedPlan.planNo}&objectNo=${objectNo}`) + router.push(`/floor-plan/simulator/6?pid=${selectedPlan?.planNo??pid}&objectNo=${objectNo}`) if (pathname === '/floor-plan/simulator/6') { setIsGlobalLoading(false) } diff --git a/src/components/simulator/Simulator.jsx b/src/components/simulator/Simulator.jsx index 6683ff9e..94307e8d 100644 --- a/src/components/simulator/Simulator.jsx +++ b/src/components/simulator/Simulator.jsx @@ -114,7 +114,7 @@ export default function Simulator() { setHatsudenryouPeakcutAllSnow([]) if (objectNo && pid && selectedPlan) { - fetchObjectDetail(objectNo, selectedPlan.planNo) + fetchObjectDetail(objectNo, selectedPlan?.planNo??pid) fetchSimulatorNotice() setPwrGnrSimType('D') setPwrRecoil({ ...pwrRecoil, type: 'D' })