diff --git a/src/ts/@overflow/app/config/index.ts b/src/ts/@overflow/app/config/index.ts index 888c3b2..6b7bd6a 100644 --- a/src/ts/@overflow/app/config/index.ts +++ b/src/ts/@overflow/app/config/index.ts @@ -9,6 +9,7 @@ import readProbeReducer from '@overflow/probe/redux/reducer/read'; import readAllByTargetReducer from '@overflow/sensor/redux/reducer/read_all_by_target'; import SensorReadReducer from '@overflow/sensor/redux/reducer/read'; +import SensorItemReadAllBySensorReducer from '@overflow/sensor/redux/reducer/item_read_all_by_sensor'; import AsyncRequest from '@overflow/app/redux/saga/AsyncRequest'; diff --git a/src/ts/@overflow/sensor/redux/reducer/item_read_all_by_sensor.ts b/src/ts/@overflow/sensor/redux/reducer/item_read_all_by_sensor.ts new file mode 100644 index 0000000..6031adf --- /dev/null +++ b/src/ts/@overflow/sensor/redux/reducer/item_read_all_by_sensor.ts @@ -0,0 +1,27 @@ +/** + * Created by geek on 17. 7. 3. + */ + +import Action from '@overflow/commons/redux/Action'; +import { ReducersMapObject } from 'redux'; +import SensorItem from '@overflow/sensor/api/model/SensorItem'; + +import * as ItemReadAllBySensorActionTypes from '../action/item_read_all_by_sensor'; +import ItemReadAllBySensorState, { defaultState as itemReadAllBySensorDefaultState } from '../state/ItemReadAllBySensor'; + +const reducer: ReducersMapObject = { + [ItemReadAllBySensorActionTypes.REQUEST_SUCCESS]: + (state: ItemReadAllBySensorState = itemReadAllBySensorDefaultState, action: Action): ItemReadAllBySensorState => { + console.log(action); + return { + ...state, + SensorItemList:action.payload, + }; + }, + [ItemReadAllBySensorActionTypes.REQUEST_FAILURE]: + (state: ItemReadAllBySensorState = itemReadAllBySensorDefaultState, action: Action): ItemReadAllBySensorState => { + return state; + }, +}; + +export default reducer; diff --git a/src/ts/@overflow/sensor/redux/reducer/item_read_by_sensor.ts b/src/ts/@overflow/sensor/redux/reducer/item_read_by_sensor.ts deleted file mode 100644 index 5c15c15..0000000 --- a/src/ts/@overflow/sensor/redux/reducer/item_read_by_sensor.ts +++ /dev/null @@ -1,3 +0,0 @@ -/** - * Created by geek on 17. 7. 3. - */ diff --git a/src/ts/@overflow/sensor/redux/state/ItemReadAllBySensor.ts b/src/ts/@overflow/sensor/redux/state/ItemReadAllBySensor.ts new file mode 100644 index 0000000..fab3b07 --- /dev/null +++ b/src/ts/@overflow/sensor/redux/state/ItemReadAllBySensor.ts @@ -0,0 +1,16 @@ +/** + * Created by geek on 17. 7. 3. + */ +import SensorItem from '../../api/model/SensorItem'; + +export interface State { + readonly SensorItemList: SensorItem[]; + readonly error?: Error; +} + +export const defaultState: State = { + SensorItemList: undefined, + error: undefined, +}; + +export default State; diff --git a/src/ts/@overflow/sensor/redux/state/ItemReadBySensor.ts b/src/ts/@overflow/sensor/redux/state/ItemReadBySensor.ts deleted file mode 100644 index 5c15c15..0000000 --- a/src/ts/@overflow/sensor/redux/state/ItemReadBySensor.ts +++ /dev/null @@ -1,3 +0,0 @@ -/** - * Created by geek on 17. 7. 3. - */