2018-04-06 11:02:18 +00:00
|
|
|
import {
|
|
|
|
createSelector,
|
|
|
|
createFeatureSelector,
|
|
|
|
ActionReducerMap,
|
|
|
|
} from '@ngrx/store';
|
|
|
|
|
|
|
|
import { StateSelector } from 'packages/core/ngrx/store';
|
|
|
|
|
|
|
|
import { MODULE } from '../sensor.constant';
|
|
|
|
|
|
|
|
import * as ListStore from './list';
|
2018-04-18 11:28:53 +00:00
|
|
|
import * as DetailStore from './detail';
|
2018-04-06 11:02:18 +00:00
|
|
|
|
|
|
|
export interface State {
|
|
|
|
list: ListStore.State;
|
2018-04-18 11:28:53 +00:00
|
|
|
sensor: DetailStore.State;
|
2018-04-06 11:02:18 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
export const REDUCERS = {
|
|
|
|
list: ListStore.reducer,
|
2018-04-18 11:28:53 +00:00
|
|
|
sensor: DetailStore.reducer,
|
2018-04-06 11:02:18 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
export const EFFECTS = [
|
|
|
|
ListStore.Effects,
|
2018-04-18 11:28:53 +00:00
|
|
|
DetailStore.Effects,
|
2018-04-06 11:02:18 +00:00
|
|
|
];
|
|
|
|
|
|
|
|
export const sensorState = createFeatureSelector<State>(MODULE.name);
|
|
|
|
|
|
|
|
export const sensorListSelector = new StateSelector<ListStore.State>(createSelector(
|
|
|
|
sensorState,
|
|
|
|
(state: State) => state.list
|
|
|
|
));
|
2018-04-18 11:28:53 +00:00
|
|
|
export const sensorSelector = new StateSelector<DetailStore.State>(createSelector(
|
2018-04-06 11:02:18 +00:00
|
|
|
sensorState,
|
|
|
|
(state: State) => state.sensor
|
|
|
|
));
|
|
|
|
|