diff --git a/src/redux/features/comn/crtfyhp/crtfyhpSlice.ts b/src/redux/features/comn/crtfyhp/crtfyhpSlice.ts new file mode 100644 index 00000000..8fe43245 --- /dev/null +++ b/src/redux/features/comn/crtfyhp/crtfyhpSlice.ts @@ -0,0 +1,48 @@ +import { createSlice } from '@reduxjs/toolkit'; + +const initCrtfyhp = { + isRunning: false, + isCrtfyhp: false, + sendCount: 0, + counter: { + min: '03', + sec: '00' + } +}; + +const crtfyhpSlice = createSlice({ + name: 'crtfyhpSlice', + initialState: initCrtfyhp, + reducers: { + isStartTimer: (state, action) => { + state.isRunning = action.payload as boolean; + }, + isSendCrtfyhp: (state, action) => { + state.isCrtfyhp = action.payload as boolean; + }, + setSendCount: (state, action) => { + state.sendCount = state.sendCount + 1; + }, + setCounter: (state, action) => { + state.counter = action.payload as { + min: string; + sec: string; + }; + }, + resetTimer: (state, action) => { + state.isRunning = false; + state.isCrtfyhp = false; + state.counter = { min: '03', sec: '00' }; + } + } +}); + +export const { + isStartTimer, + isSendCrtfyhp, + setSendCount, + setCounter, + resetTimer +} = crtfyhpSlice.actions; + +export const crtfyhpReducer = crtfyhpSlice.reducer; diff --git a/src/redux/rootReducer.ts b/src/redux/rootReducer.ts index 19467907..bb217d0a 100644 --- a/src/redux/rootReducer.ts +++ b/src/redux/rootReducer.ts @@ -20,12 +20,14 @@ import { controlGpLogReducer } from './features/control/gp/gpSlice'; import { controlGpHisReducer } from './features/control/gp/gpSlice'; import { controlGpDtlReducer } from './features/control/gp/gpSlice'; import { controlGpCountReducer } from './features/control/gp/gpSlice'; +import { crtfyhpReducer } from './features/comn/crtfyhp/crtfyhpSlice'; const rootReducer = (state: any, action: any) => { const combineReducer = combineReducers({ // common layoutState: layoutReducer, messageState: messageReducer, + crtfyhpState: crtfyhpReducer, // account authState: authReducer, findState: findReducer,