From c567495c3fcb35a6cce69c4967e0b65741aed147 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=EB=B0=95=EC=83=81=ED=98=84?= Date: Tue, 20 Feb 2024 17:57:00 +0900 Subject: [PATCH] =?UTF-8?q?[redux-tookit]=20=ED=86=B5=EA=B3=84=20type=20?= =?UTF-8?q?=EC=88=98=EC=A0=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../features/analysis/history/historyState.ts | 9 ++ .../features/analysis/history/historyThunk.ts | 10 +-- .../features/statistics/statisticsSlice.ts | 89 +++++++++++++++++-- .../features/statistics/statisticsState.ts | 75 ---------------- .../simulation/AnalysisSimulationMarker.js | 1 - 5 files changed, 93 insertions(+), 91 deletions(-) diff --git a/src/_redux/features/analysis/history/historyState.ts b/src/_redux/features/analysis/history/historyState.ts index 0c8ece5d..42c76aee 100644 --- a/src/_redux/features/analysis/history/historyState.ts +++ b/src/_redux/features/analysis/history/historyState.ts @@ -65,3 +65,12 @@ export interface IGetHstryLogRs { trmnlRcvDt: Date; srvrRcvDt: Date; } + +export interface IHstryListRq { + searchParams: { + endDate: string; + search1: string; + page: number; + }; + page: number; +} diff --git a/src/_redux/features/analysis/history/historyThunk.ts b/src/_redux/features/analysis/history/historyThunk.ts index 92fd983e..99a62de6 100644 --- a/src/_redux/features/analysis/history/historyThunk.ts +++ b/src/_redux/features/analysis/history/historyThunk.ts @@ -8,18 +8,12 @@ import { SAVE_MESSAGE, DELETE_MESSAGE } from '@src/configs/constants'; +import { IHstryListRq } from './historyState'; // 비행이력 조회 export const getHstryList = createAsyncThunk( 'analysis/getHstryList', - async ( - data: { - searchParams: any; - data: any; - page: number; - }, - thunkAPI - ) => { + async (data: IHstryListRq, thunkAPI) => { const { rejectWithValue } = thunkAPI; try { const queryString = qs.stringify(data.searchParams, { diff --git a/src/_redux/features/statistics/statisticsSlice.ts b/src/_redux/features/statistics/statisticsSlice.ts index fb87cf0d..822f56f3 100644 --- a/src/_redux/features/statistics/statisticsSlice.ts +++ b/src/_redux/features/statistics/statisticsSlice.ts @@ -1,5 +1,5 @@ import { createSlice } from '@reduxjs/toolkit'; -import { initialState } from './statisticsState'; +import { IStatisticsState, IStcsRs, IStcsSearchRs } from './statisticsState'; import { getFlightStatistics, getFlightSearch, @@ -9,28 +9,103 @@ import { getAbnormalSearch } from './statisticsThunk'; +export const initialState: IStatisticsState = { + flight: [ + { + name: '-', + year: '00:00:00', + month: '00:00:00', + day: '00:00:00' + }, + { + name: '-', + year: 0, + month: 0, + day: 0 + }, + { + name: '-', + year: 0, + month: 0, + day: 0 + } + ], + flightSearch: { + graphData: [], + topData: [] + }, + abnormal: [ + { + name: '-', + year: 0, + month: 0, + day: 0 + }, + { + name: '-', + year: 0, + month: 0, + day: 0 + }, + { + name: '-', + year: 0, + month: 0, + day: 0 + } + ], + abnormalSearch: { + graphData: [], + topData: [] + }, + result: [ + { + name: '-', + year: 0, + month: 0, + day: 0 + }, + { + name: '-', + year: 0, + month: 0, + day: 0 + }, + { + name: '-', + year: 0, + month: 0, + day: 0 + } + ], + resultSearch: { + graphData: [], + topData: [] + } +}; + const statisticsSlice = createSlice({ name: 'statisticsSlice', initialState: initialState, reducers: {}, extraReducers: builder => { builder.addCase(getFlightStatistics.fulfilled, (state, action) => { - state.flight = action.payload; + state.flight = action.payload as IStcsRs[]; }); builder.addCase(getFlightSearch.fulfilled, (state, action) => { - state.flightSearch = action.payload; + state.flightSearch = action.payload as IStcsSearchRs; }); builder.addCase(getAbnormalStatistics.fulfilled, (state, action) => { - state.abnormal = action.payload; + state.abnormal = action.payload as IStcsRs[]; }); builder.addCase(getResultStatistics.fulfilled, (state, action) => { - state.result = action.payload; + state.result = action.payload as IStcsRs[]; }); builder.addCase(getResultSearch.fulfilled, (state, action) => { - state.resultSearch = action.payload; + state.resultSearch = action.payload as IStcsSearchRs; }); builder.addCase(getAbnormalSearch.fulfilled, (state, action) => { - state.abnormalSearch = action.payload; + state.abnormalSearch = action.payload as IStcsSearchRs; }); } }); diff --git a/src/_redux/features/statistics/statisticsState.ts b/src/_redux/features/statistics/statisticsState.ts index 024a9f46..c2904b7e 100644 --- a/src/_redux/features/statistics/statisticsState.ts +++ b/src/_redux/features/statistics/statisticsState.ts @@ -33,78 +33,3 @@ export interface IStcsSearchRq { type: string; serviceType: string; } - -export const initialState: IStatisticsState = { - flight: [ - { - name: '-', - year: '00:00:00', - month: '00:00:00', - day: '00:00:00' - }, - { - name: '-', - year: 0, - month: 0, - day: 0 - }, - { - name: '-', - year: 0, - month: 0, - day: 0 - } - ], - flightSearch: { - graphData: [], - topData: [] - }, - abnormal: [ - { - name: '-', - year: 0, - month: 0, - day: 0 - }, - { - name: '-', - year: 0, - month: 0, - day: 0 - }, - { - name: '-', - year: 0, - month: 0, - day: 0 - } - ], - abnormalSearch: { - graphData: [], - topData: [] - }, - result: [ - { - name: '-', - year: 0, - month: 0, - day: 0 - }, - { - name: '-', - year: 0, - month: 0, - day: 0 - }, - { - name: '-', - year: 0, - month: 0, - day: 0 - } - ], - resultSearch: { - graphData: [], - topData: [] - } -}; diff --git a/src/components/analysis/simulation/AnalysisSimulationMarker.js b/src/components/analysis/simulation/AnalysisSimulationMarker.js index 1a1561c9..77b9135d 100644 --- a/src/components/analysis/simulation/AnalysisSimulationMarker.js +++ b/src/components/analysis/simulation/AnalysisSimulationMarker.js @@ -17,7 +17,6 @@ export const AnalysisSimulationMarker = props => { props.selMarker.setMap(null); } - console.log('>>', props.data); if (props.data.length != 0) { const val = []; for (let i = 0; i < props.data?.length; i++) {