From 635c32105b1f22cdda29bc07445dc8419ed30871 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=EB=B0=95=EC=83=81=ED=98=84?= Date: Fri, 27 Oct 2023 14:10:02 +0900 Subject: [PATCH] =?UTF-8?q?laanc=20=EC=9E=AC=20=ED=98=B8=EC=B6=9C=20?= =?UTF-8?q?=EB=A7=89=EB=8A=94=20debounce=20=20=EC=B6=94=EA=B0=80?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/components/laanc/step/LaancStep1.js | 3 ++ src/components/laanc/step/LaancStep2.js | 1 + src/modules/laanc/sagas/laancSagas.ts | 43 ++++++++----------------- 3 files changed, 17 insertions(+), 30 deletions(-) diff --git a/src/components/laanc/step/LaancStep1.js b/src/components/laanc/step/LaancStep1.js index 625cd68..6d9aa82 100644 --- a/src/components/laanc/step/LaancStep1.js +++ b/src/components/laanc/step/LaancStep1.js @@ -157,10 +157,13 @@ export default function LaancStep1({ // 고도 150 미만 핸들러 const handleBlur = (value, type) => { const maxElev = 150; + + // 관제권안에서 허용고도 초과시 경고문 const controlledAltitudeExceededWarning = laancArea?.duplicated && parseInt(value.replace('/^0+/', 'm', ''), 10) >= laancElev && parseInt(value.replace('/^0+/', 'm', ''), 10) < maxElev; + switch (type) { case 'fltElev': if ( diff --git a/src/components/laanc/step/LaancStep2.js b/src/components/laanc/step/LaancStep2.js index 9becea7..205deff 100644 --- a/src/components/laanc/step/LaancStep2.js +++ b/src/components/laanc/step/LaancStep2.js @@ -67,6 +67,7 @@ export default function LaancStep2({ handlerStep(3); } }, [laancPdf]); + // 소수점 6자리에서 반올림 하는 함수 const truncateToSixDecimalPlaces = number => { const decimalPlaces = 6; diff --git a/src/modules/laanc/sagas/laancSagas.ts b/src/modules/laanc/sagas/laancSagas.ts index 44b93b7..1f7bb3e 100644 --- a/src/modules/laanc/sagas/laancSagas.ts +++ b/src/modules/laanc/sagas/laancSagas.ts @@ -1,4 +1,10 @@ -import { call, put, select, takeEvery } from '@redux-saga/core/effects'; +import { + call, + put, + takeLatest, + takeEvery, + debounce +} from '@redux-saga/core/effects'; import * as Actions from '../actions/laancActions'; import { ActionType } from 'typesafe-actions'; import * as MessageActions from '../../comn/message/actions/comnMessageAction'; @@ -7,7 +13,7 @@ import { ERROR_MESSAGE, SAVE_MESSAGE } from '../../../configs/constants'; // pdf 연결 // laanc 승인 여부 -function* postApprovalsata( +function* postApprovalSaga( action: ActionType ) { try { @@ -15,16 +21,6 @@ function* postApprovalsata( const res = yield call(Apis.laancApi.postApproval, detail); - // const { data } = res; - - // yield put( - // MessageActions.IS_MESSAGE({ - // messageCode: SAVE_MESSAGE.code, - // message: SAVE_MESSAGE.message, - // isHistoryBack: true, - // isRefresh: false - // }) - // ); yield put(Actions.LAANC_FLIGHT_Approval.success(res.data)); } catch (error) { yield put( @@ -35,29 +31,16 @@ function* postApprovalsata( isRefresh: false }) ); - // yield put(Actions.FLIGHT_PLAN_CREATE.failure(error)); } } // laanc 생성 -function* postCreatesata( +export function* postCreateSaga( action: ActionType ) { try { const detail = action.payload; - const res = yield call(Apis.laancApi.postCreate, detail); - - // const { data } = res; - // localStorage.setItem('pdfUrl', res.data.pdfUrl); - // yield put( - // MessageActions.IS_MESSAGE({ - // messageCode: SAVE_MESSAGE.code, - // message: SAVE_MESSAGE.message, - // isHistoryBack: true, - // isRefresh: false - // }) - // ); yield put(Actions.LAANC_FLIGHT_CREATE.success(res.data)); } catch (error) { yield put( @@ -68,9 +51,9 @@ function* postCreatesata( isRefresh: false }) ); - // yield put(Actions.FLIGHT_PLAN_CREATE.failure(error)); } } + // laanc 일물 일출 function* getSunDataSaga( action: ActionType @@ -170,10 +153,10 @@ function* postValidAreaSaga( } } export function* laancSaga() { - yield takeEvery(Actions.LAANC_FLIGHT_Approval.request, postApprovalsata); - yield takeEvery(Actions.LAANC_FLIGHT_CREATE.request, postCreatesata); + yield takeEvery(Actions.LAANC_FLIGHT_Approval.request, postApprovalSaga); + yield debounce(500, Actions.LAANC_FLIGHT_CREATE.request, postCreateSaga); yield takeEvery(Actions.LAANC_SUN_DATA.request, getSunDataSaga); - yield takeEvery(Actions.LAANC_APRV_LIST.request, getAprvListSaga); + yield debounce(500, Actions.LAANC_APRV_LIST.request, getAprvListSaga); yield takeEvery(Actions.LAANC_DETAIL.request, getDetailSaga); yield takeEvery(Actions.LAANC_ALTITUDE.request, postValidElevSaga); yield takeEvery(Actions.LAANC_VALID_AREA.request, postValidAreaSaga);