Browse Source

controlGp type 정의

master
김장현 7 months ago
parent
commit
020f3ccace
  1. 198
      src/_redux/features/control/gp/gpSlice.ts
  2. 39
      src/_redux/features/control/gp/gpState.ts
  3. 6
      src/_redux/features/control/gp/gpThunk.ts

198
src/_redux/features/control/gp/gpSlice.ts

@ -1,10 +1,9 @@
import { createSlice } from '@reduxjs/toolkit';
import {
initiaControlGp,
IControlGpArcrftWarnListRs,
IControlGpRq,
IControlGroupAuthData,
IControlGpCountData,
IControlDetailRs
IControlGpState,
IControlGroupAuthData
} from './gpState';
import {
getHistory,
@ -19,7 +18,12 @@ import {
controlDt
} from './gpThunk';
interface Iasd {
export const initiaControlGp: IControlGpState = {
controlGpList: [],
controlGroupAuthInfo: []
};
interface IControlGpPayload {
controlGpList: IControlGpRq[];
controlGroupAuthInfo: IControlGroupAuthData[];
}
@ -30,107 +34,109 @@ const controlGpSlice = createSlice({
reducers: {},
extraReducers: builder => {
builder.addCase(getControlGp.fulfilled, (state, action) => {
// const { controlGpList, controlGroupAuthInfo } = action.payload;
// state.controlGpList = controlGpList as IControlGpRq[];
// state.controlGroupAuthInfo = controlGroupAuthInfo;
const { controlGpList, controlGroupAuthInfo } =
action.payload as IControlGpPayload;
state.controlGpList = controlGpList;
state.controlGroupAuthInfo = controlGroupAuthInfo;
});
}
});
const controlGpFlightPlanSlice = createSlice({
name: 'controlGpFlightPlanSlice',
initialState: initiaControlGp,
reducers: {
ClientcontrolGpFlightPlanInit: (state, action) => {
state.controlGpFltPlanList = undefined;
}
},
extraReducers: builder => {
builder.addCase(checkPlanContains.fulfilled, (state, action) => {
const data = action.payload;
state.controlGpContains = data;
});
// const controlGpFlightPlanSlice = createSlice({
// name: 'controlGpFlightPlanSlice',
// initialState: initiaControlGp,
// reducers: {
// ClientcontrolGpFlightPlanInit: (state, action) => {
// state.controlGpFltPlanList = undefined;
// }
// },
// extraReducers: builder => {
// builder.addCase(checkPlanContains.fulfilled, (state, action) => {
// const data = action.payload;
// state.controlGpContains = data;
// });
builder.addCase(getFlightPlan.fulfilled, (state, action) => {
const list = action.payload;
state.controlGpFltPlanList = list;
});
}
});
// builder.addCase(getFlightPlan.fulfilled, (state, action) => {
// const list = action.payload;
// state.controlGpFltPlanList = list;
// });
// }
// });
const controlGpLogSlice = createSlice({
name: 'controlGpLogSlice',
initialState: initiaControlGp,
reducers: {},
extraReducers: builder => {
builder.addCase(getWarnLog.fulfilled, (state, action) => {
const data = action.payload;
state.controlGpWarnLog = data;
});
builder.addCase(getArcrftWarn.fulfilled, (state, action) => {
const list = action.payload;
state.controlGpArcrftWarnList = list;
});
}
});
// const controlGpLogSlice = createSlice({
// name: 'controlGpLogSlice',
// initialState: initiaControlGp,
// reducers: {},
// extraReducers: builder => {
// builder.addCase(getWarnLog.fulfilled, (state, action) => {
// const data = action.payload;
// state.controlGpWarnLog = data;
// });
// builder.addCase(getArcrftWarn.fulfilled, (state, action) => {
// const list = action.payload;
// state.controlGpArcrftWarnList = list;
// });
// }
// });
const controlGpHisSlice = createSlice({
name: 'controlGpHisSlice',
initialState: initiaControlGp,
reducers: {},
extraReducers: builder => {
builder.addCase(getHistory.fulfilled, (state, action) => {
const { controlGpHistory } = action.payload;
state.controlGpHistory = controlGpHistory;
});
}
});
// const controlGpHisSlice = createSlice({
// name: 'controlGpHisSlice',
// initialState: initiaControlGp,
// reducers: {},
// extraReducers: builder => {
// builder.addCase(getHistory.fulfilled, (state, action) => {
// const { controlGpHistory } = action.payload;
// state.controlGpHistory = controlGpHistory;
// });
// }
// });
const controlGpDtlSlice = createSlice({
name: 'controlGpDtlSlice',
initialState: initiaControlGp,
reducers: {},
extraReducers: builder => {
builder.addCase(getDetail.fulfilled, (state, action) => {
const { controlGpDetail } = action.payload;
state.controlGpDetail = controlGpDetail;
});
builder.addCase(apiweather.fulfilled, (state, action) => {
state.controlWheather = action.payload;
});
builder.addCase(controlDt.fulfilled, (state, action) => {
const data: any = action.payload;
state.controlDetail = data;
// state.controlDetail = action.payload;
});
}
});
// const controlGpDtlSlice = createSlice({
// name: 'controlGpDtlSlice',
// initialState: initiaControlGp,
// reducers: {},
// extraReducers: builder => {
// builder.addCase(getDetail.fulfilled, (state, action) => {
// const { controlGpDetail } = action.payload;
// state.controlGpDetail = controlGpDetail;
// });
// builder.addCase(apiweather.fulfilled, (state, action) => {
// state.controlWheather = action.payload;
// });
// builder.addCase(controlDt.fulfilled, (state, action) => {
// const data: any = action.payload;
// state.controlDetail = data;
// // state.controlDetail = action.payload;
// });
// }
// });
export const controlGpCountSlice = createSlice({
name: 'controlGpCountSlice',
initialState: initiaControlGp,
reducers: {
ClientcontrolGpCountInit: (state, action) => {
const drone = action.payload.count.drone;
const flight = action.payload.count.flight;
// export const controlGpCountSlice = createSlice({
// name: 'controlGpCountSlice',
// initialState: initiaControlGp,
// reducers: {
// ClientcontrolGpCountInit: (state, action) => {
// const drone = action.payload.count.drone;
// const flight = action.payload.count.flight;
state.controlGpCountDrone = drone;
state.controlGpCountFlight = flight;
}
}
});
// state.controlGpCountDrone = drone;
// state.controlGpCountFlight = flight;
// }
// }
// });
export const { ClientcontrolGpFlightPlanInit } =
controlGpFlightPlanSlice.actions;
export const controlGpLogAction = controlGpLogSlice.actions;
export const controlGpHisAction = controlGpHisSlice.actions;
export const controlGpRtDtlAction = controlGpDtlSlice.actions;
export const { ClientcontrolGpCountInit } = controlGpCountSlice.actions;
export const controlGpDtlAction = controlGpDtlSlice.actions;
// export const { ClientcontrolGpFlightPlanInit } =
// controlGpFlightPlanSlice.actions;
// export const controlGpLogAction = controlGpLogSlice.actions;
// export const controlGpHisAction = controlGpHisSlice.actions;
// export const controlGpRtDtlAction = controlGpDtlSlice.actions;
// export const { ClientcontrolGpCountInit } = controlGpCountSlice.actions;
// export const controlGpDtlAction = controlGpDtlSlice.actions;
export const controlGpReducer = controlGpSlice.reducer;
export const controlGpLogReducer = controlGpLogSlice.reducer;
export const controlGpHisReducer = controlGpHisSlice.reducer;
export const controlGpDtlReducer = controlGpDtlSlice.reducer;
export const controlGpFltPlanReducer = controlGpFlightPlanSlice.reducer;
export const controlGpCountReducer = controlGpCountSlice.reducer;
// export const controlGpLogReducer = controlGpLogSlice.reducer;
// export const controlGpHisReducer = controlGpHisSlice.reducer;
// export const controlGpDtlReducer = controlGpDtlSlice.reducer;
// export const controlGpFltPlanReducer = controlGpFlightPlanSlice.reducer;
// export const controlGpCountReducer = controlGpCountSlice.reducer;

39
src/_redux/features/control/gp/gpState.ts

@ -15,50 +15,33 @@ export interface IControlGpState {
// controlGpCountFlight: ControlGpCountData[] | undefined;
}
export const initiaControlGp = {
controlGpList: [],
controlGpDetail: undefined,
controlGpHistory: undefined,
controlGpWarnLog: undefined,
controlDetail: undefined,
controlGroupAuthInfo: [],
controlGpFltPlanList: undefined,
controlGpWarnLogList: undefined,
controlGpContains: undefined,
controlGpArcrftWarnList: undefined,
rescontrolweatherData: undefined,
controlWheather: undefined,
controlGpCountDrone: undefined,
controlGpCountFlight: undefined
};
export interface ControlGpFlightPlanState {
controlGpFltPlanList: IControlGpFlightPlanDataListRs | undefined;
controlGpContains: IControlGpPlanContainsRS | undefined;
controlGpFltPlanList: IControlGpFlightPlanDataListRs;
controlGpContains: IControlGpPlanContainsRS;
}
export interface ControlGpLogState {
controlGpWarnLog: ControlGpWarnLogList | undefined;
controlGpArcrftWarnList: IControlGpArcrftWarnListRs | undefined;
controlGpWarnLog: ControlGpWarnLogList;
controlGpArcrftWarnList: IControlGpArcrftWarnListRs;
}
export interface ControlGpHisState {
controlGpHistory: IControlGpHistoryData[] | undefined;
controlGpHistory: IControlGpHistoryData[];
}
export interface ControlGpDtlState {
controlGpDetail: IControlGpDtlData | undefined;
controlDetail: IControlDetailRs | undefined;
controlWheather: IControlweatherRs | undefined;
controlGpDetail: IControlGpDtlData;
controlDetail: IControlDetailRs;
controlWheather: IControlweatherRs;
}
export interface ControlGpCountState {
controlGpCountDrone: IControlGpCountData[] | undefined;
controlGpCountFlight: IControlGpCountData[] | undefined;
controlGpCountDrone: IControlGpCountData[];
controlGpCountFlight: IControlGpCountData[];
}
export interface IControlGpCountData {
gps: IControlGpRq | undefined;
gps: IControlGpRq;
type: string;
}

6
src/_redux/features/control/gp/gpThunk.ts

@ -71,8 +71,7 @@ export const getControlGp = createAsyncThunk(
cntrlId: param
};
const rs = getArcrftWarnList(obj);
return rs;
await dispatch(getArcrftWarnList(obj));
}
if (objectId) {
@ -85,8 +84,7 @@ export const getControlGp = createAsyncThunk(
detailData = item;
}
});
// yield put(Actions.controlGpRtDtlAction.request(detailData));
// await dispatch(controlGpRtDtlAction(detailData))
}
} catch (error) {
// yield put(Actions.controlGpAction.failure(error));

Loading…
Cancel
Save