Browse Source

Reducer, Action 생성 및 수정

feature/flight-area
junh_eee(이준희) 2 years ago
parent
commit
36c0aa7550
  1. 33
      src/modules/basis/flight/actions/basisFlightDrawAction.ts
  2. 59
      src/modules/basis/flight/reducers/basisFlightDrawReducer.ts
  3. 7
      src/modules/control/map/reducers/controlMapReducer.ts
  4. 4
      src/redux/reducers/rootReducer.ts

33
src/modules/basis/flight/actions/basisFlightDrawAction.ts

@ -0,0 +1,33 @@
// draw 옵션 변경 Action
export const polylineChangeAction = (value: any) => dispatch =>
dispatch({type: 'POLYLINE_CHANGE', value});
export const guidelineChangeAction = (value: any) => dispatch =>
dispatch({type: 'GUIDELINE_CHANGE', value});
export const bufferpolylineChangeAction = (value: any) => dispatch =>
dispatch({type: 'BUFFERPOLYLINE_CHANGE', value});
export const polygonChangeAction = (value: any) => dispatch =>
dispatch({type: 'POLYGON_CHANGE', value});
export const circleChangeAction = (value: any) => dispatch =>
dispatch({type: 'CIRCLE_CHANGE', value});
export const radiuslineChangeAction = (value: any) => dispatch =>
dispatch({type: 'RADIUSLINE_CHANGE', value});
export const clickEveChangeAction = (value: any) => dispatch =>
dispatch({type: 'CLICKEVE_CHANGE', value});
export const mousedownEveChangeAction = (value: any) => dispatch =>
dispatch({type: 'MOUSEDOWNEVE_CHANGE', value});
export const rightclickEveChangeAction = (value: any) => dispatch =>
dispatch({type: 'RIGHTCLICKEVE_CHANGE', value});
export const dragCircleChangeAction = (value: any) => dispatch =>
dispatch({type: 'DRAGCIRCLE_CHANGE', value});
export const checkChangeAction = (value: any) => dispatch =>
dispatch({type: 'CHECK_CHANGE', value});

59
src/modules/basis/flight/reducers/basisFlightDrawReducer.ts

@ -0,0 +1,59 @@
// ** Initial State
const initial = {
polyline: '',
guideline: '',
bufferPolyline: '',
polygon: '',
circle: '',
radiusline: '',
clickEve: '',
mousedownEve: '',
rightclickEve: '',
dragCircle: [],
check: ''
};
const drawReducerReducer = (state = initial, action) => {
switch (action.type) {
case 'POLYLINE_CHANGE':
return {...state, polyline: action.value};
case 'GUIDELINE_CHANGE':
return { ...state, guideline: action.value};
case 'BUFFERPOLYLINE_CHANGE':
return {...state, bufferPolyline: action.value};
case 'POLYGON_CHANGE':
return {...state, polygon: action.value};
case 'CIRCLE_CHANGE':
return {...state, circle: action.value};
case 'RADIUSLINE_CHANGE':
return {...state, radiusline: action.value};
case 'CLICKEVE_CHANGE':
return {...state, clickEve: action.value};
case 'MOUSEDOWNEVE_CHANGE':
return {...state, mousedownEve: action.value};
case 'RIGHTCLICKEVE_CHANGE':
return {...state, rightclickEve: action.value};
case 'DRAGCIRCLE_CHANGE':
return {...state, dragCircle: action.value};
case 'CHECK_CHANGE':
return {...state, check: action.value};
default:
return state;
}
};
export default drawReducerReducer;

7
src/modules/control/map/reducers/controlMapReducer.ts

@ -1,6 +1,6 @@
// ** Initial State
const initialState = {
mapType: 'HYBRID',
mapType: 'NORMAL',
objectId: null,
isClickObject: false,
area0001: true, // 비행금지 구역
@ -11,9 +11,10 @@ const initialState = {
area0006: true, // 초경량비행장치
sensor: 'dust',
drawType: '',
drawType: null,
drawCheck: false
// drawCheck: false
drawCheck: ''
};
const controlReducerReducer = (state = initialState, action) => {

4
src/redux/reducers/rootReducer.ts

@ -22,6 +22,9 @@ import {
ControlGpState
} from '../../modules/control/gp';
import controlMapReducer from '../../modules/control/map/reducers/controlMapReducer';
import basisFlightDrawReducer from '../../modules/basis/flight/reducers/basisFlightDrawReducer';
import { mainDahReducer } from '../../modules/main/dash/reducers/mainDashReducer';
import { mainDashSaga } from '../../modules/main/dash/sagas/mainDashSaga';
import { menuReducer } from '../../modules/menu/reducers/menuReducer';
@ -53,6 +56,7 @@ const rootReducer = combineReducers({
navbar,
layout,
controlMapReducer,
basisFlightDrawReducer,
mainDashState: mainDahReducer,
messageState: messageReducer,
groupState: groupReducer,

Loading…
Cancel
Save