member_webapp/src/packages/sensor/store/index.ts

40 lines
864 B
TypeScript
Raw Normal View History

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';
import * as DetailStore from './detail';
2018-04-06 11:02:18 +00:00
export interface State {
list: ListStore.State;
sensor: DetailStore.State;
2018-04-06 11:02:18 +00:00
}
export const REDUCERS = {
list: ListStore.reducer,
sensor: DetailStore.reducer,
2018-04-06 11:02:18 +00:00
};
export const EFFECTS = [
ListStore.Effects,
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
));
export const sensorSelector = new StateSelector<DetailStore.State>(createSelector(
2018-04-06 11:02:18 +00:00
sensorState,
(state: State) => state.sensor
));