From 01b96dbd2262a5f49c16551c7ad5ed19ce86c34e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?dhji=28=EC=A7=80=EB=8C=80=ED=95=9C=29?= Date: Fri, 5 Aug 2022 10:11:08 +0900 Subject: [PATCH] . --- .../plan/FlightPlanAreaDetailContainer.js | 34 +++++++++---------- 1 file changed, 16 insertions(+), 18 deletions(-) diff --git a/src/containers/basis/flight/plan/FlightPlanAreaDetailContainer.js b/src/containers/basis/flight/plan/FlightPlanAreaDetailContainer.js index 917a5be..d6df9b7 100644 --- a/src/containers/basis/flight/plan/FlightPlanAreaDetailContainer.js +++ b/src/containers/basis/flight/plan/FlightPlanAreaDetailContainer.js @@ -10,30 +10,28 @@ const FlightPlanAreaDetailContainer = ({ handleModal }) => { const dispatch = useDispatch(); const mapControl = useSelector(state => state.controlMapReducer); - const mapControl = useSelector(state => state.controlMapReducer); - - const { areaCoordList, detail } = useSelector(state => state.flightState); + const { areaCoordList, detail } = useSelector(state => state.flightState); const [areaDetail, setAreaDetail] = useState(initFlightBas.initDetail.areaList); const handleClose = (status) => { - handleModal({ type: 'area', isOpne: false}); + handleModal({ type: 'area', isOpne: false}); } - const handleSave = () => { + const handleSave = () => { const resultAreaDetail = areaDetail.map((area, i) => { return { ...area, coordList : areaDetail[0].coordList } - }); - + }); + dispatch(Actions.AREA_DETAIL_LIST_SAVE(resultAreaDetail)); - handleModal({ type: 'area', isOpne: false}); + handleModal({ type: 'area', isOpne: false}); } - const handleChange = ({ name, value }) => { - setAreaDetail(prevState => { + const handleChange = ({ name, value }) => { + setAreaDetail(prevState => { const areaList = prevState.map((area, i) => { return { ...area, @@ -41,7 +39,7 @@ const FlightPlanAreaDetailContainer = ({ handleModal }) => { } }); - return areaList; + return areaList; }) } @@ -49,23 +47,23 @@ const FlightPlanAreaDetailContainer = ({ handleModal }) => { dispatch(Actions.FLIGHT_PLAN_AREA_BUFFER_LIST.request(areaDetail)); } - useEffect(() => { + useEffect(() => { // 좌표등록 (등록 시 데이터 초기화) if(areaCoordList !== undefined) { setAreaDetail(areaCoordList); // 새로 만든 영역 - } + } }, [areaCoordList]); useEffect(() => { - // detail의 area 정보가 존재하면 detail 정보로 매핑 + // detail의 area 정보가 존재하면 detail 정보로 매핑 if(detail.areaList) { if(detail.areaList[0].planAreaSno !== 0) { setAreaDetail(detail.areaList); - + dispatch(Actions.AREA_DETAIL_LIST_SAVE(detail.areaList)); - } + } } - + }, []) @@ -87,4 +85,4 @@ const FlightPlanAreaDetailContainer = ({ handleModal }) => { ) } -export default FlightPlanAreaDetailContainer; \ No newline at end of file +export default FlightPlanAreaDetailContainer;