Browse Source

laanc 재 호출 막는 debounce 추가

pull/2/head
박상현 11 months ago
parent
commit
635c32105b
  1. 3
      src/components/laanc/step/LaancStep1.js
  2. 1
      src/components/laanc/step/LaancStep2.js
  3. 43
      src/modules/laanc/sagas/laancSagas.ts

3
src/components/laanc/step/LaancStep1.js

@ -157,10 +157,13 @@ export default function LaancStep1({
// 고도 150 미만 핸들러 // 고도 150 미만 핸들러
const handleBlur = (value, type) => { const handleBlur = (value, type) => {
const maxElev = 150; const maxElev = 150;
// 관제권안에서 허용고도 초과시 경고문
const controlledAltitudeExceededWarning = const controlledAltitudeExceededWarning =
laancArea?.duplicated && laancArea?.duplicated &&
parseInt(value.replace('/^0+/', 'm', ''), 10) >= laancElev && parseInt(value.replace('/^0+/', 'm', ''), 10) >= laancElev &&
parseInt(value.replace('/^0+/', 'm', ''), 10) < maxElev; parseInt(value.replace('/^0+/', 'm', ''), 10) < maxElev;
switch (type) { switch (type) {
case 'fltElev': case 'fltElev':
if ( if (

1
src/components/laanc/step/LaancStep2.js

@ -67,6 +67,7 @@ export default function LaancStep2({
handlerStep(3); handlerStep(3);
} }
}, [laancPdf]); }, [laancPdf]);
// 소수점 6자리에서 반올림 하는 함수 // 소수점 6자리에서 반올림 하는 함수
const truncateToSixDecimalPlaces = number => { const truncateToSixDecimalPlaces = number => {
const decimalPlaces = 6; const decimalPlaces = 6;

43
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 * as Actions from '../actions/laancActions';
import { ActionType } from 'typesafe-actions'; import { ActionType } from 'typesafe-actions';
import * as MessageActions from '../../comn/message/actions/comnMessageAction'; import * as MessageActions from '../../comn/message/actions/comnMessageAction';
@ -7,7 +13,7 @@ import { ERROR_MESSAGE, SAVE_MESSAGE } from '../../../configs/constants';
// pdf 연결 // pdf 연결
// laanc 승인 여부 // laanc 승인 여부
function* postApprovalsata( function* postApprovalSaga(
action: ActionType<typeof Actions.LAANC_FLIGHT_Approval.request> action: ActionType<typeof Actions.LAANC_FLIGHT_Approval.request>
) { ) {
try { try {
@ -15,16 +21,6 @@ function* postApprovalsata(
const res = yield call(Apis.laancApi.postApproval, detail); 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)); yield put(Actions.LAANC_FLIGHT_Approval.success(res.data));
} catch (error) { } catch (error) {
yield put( yield put(
@ -35,29 +31,16 @@ function* postApprovalsata(
isRefresh: false isRefresh: false
}) })
); );
// yield put(Actions.FLIGHT_PLAN_CREATE.failure(error));
} }
} }
// laanc 생성 // laanc 생성
function* postCreatesata( export function* postCreateSaga(
action: ActionType<typeof Actions.LAANC_FLIGHT_CREATE.request> action: ActionType<typeof Actions.LAANC_FLIGHT_CREATE.request>
) { ) {
try { try {
const detail = action.payload; const detail = action.payload;
const res = yield call(Apis.laancApi.postCreate, detail); 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)); yield put(Actions.LAANC_FLIGHT_CREATE.success(res.data));
} catch (error) { } catch (error) {
yield put( yield put(
@ -68,9 +51,9 @@ function* postCreatesata(
isRefresh: false isRefresh: false
}) })
); );
// yield put(Actions.FLIGHT_PLAN_CREATE.failure(error));
} }
} }
// laanc 일물 일출 // laanc 일물 일출
function* getSunDataSaga( function* getSunDataSaga(
action: ActionType<typeof Actions.LAANC_SUN_DATA.request> action: ActionType<typeof Actions.LAANC_SUN_DATA.request>
@ -170,10 +153,10 @@ function* postValidAreaSaga(
} }
} }
export function* laancSaga() { export function* laancSaga() {
yield takeEvery(Actions.LAANC_FLIGHT_Approval.request, postApprovalsata); yield takeEvery(Actions.LAANC_FLIGHT_Approval.request, postApprovalSaga);
yield takeEvery(Actions.LAANC_FLIGHT_CREATE.request, postCreatesata); yield debounce(500, Actions.LAANC_FLIGHT_CREATE.request, postCreateSaga);
yield takeEvery(Actions.LAANC_SUN_DATA.request, getSunDataSaga); 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_DETAIL.request, getDetailSaga);
yield takeEvery(Actions.LAANC_ALTITUDE.request, postValidElevSaga); yield takeEvery(Actions.LAANC_ALTITUDE.request, postValidElevSaga);
yield takeEvery(Actions.LAANC_VALID_AREA.request, postValidAreaSaga); yield takeEvery(Actions.LAANC_VALID_AREA.request, postValidAreaSaga);

Loading…
Cancel
Save