member_webapp/@overflow/sensor/store/index.ts

40 lines
865 B
TypeScript
Raw Normal View History

2018-04-06 11:02:18 +00:00
import {
createSelector,
createFeatureSelector,
ActionReducerMap,
} from '@ngrx/store';
2018-05-24 06:44:13 +00:00
import { StateSelector } from '@overflow/core/ngrx/store';
2018-04-06 11:02:18 +00:00
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
));