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

39 lines
869 B
TypeScript
Raw Normal View History

2018-04-06 11:02:18 +00:00
import {
createSelector,
createFeatureSelector,
ActionReducerMap,
} from '@ngrx/store';
import { MODULE } from '../infra.constant';
import * as ListStore from './list';
2018-04-19 10:26:39 +00:00
import * as DetailStore from './detail';
2018-04-16 10:45:10 +00:00
import { StateSelector } from 'packages/core/ngrx/store';
2018-04-06 11:02:18 +00:00
export interface State {
list: ListStore.State;
2018-04-19 10:26:39 +00:00
sensor: DetailStore.State;
2018-04-06 11:02:18 +00:00
}
export const REDUCERS = {
list: ListStore.reducer,
2018-04-19 10:26:39 +00:00
sensor: DetailStore.reducer
2018-04-06 11:02:18 +00:00
};
export const EFFECTS = [
ListStore.Effects,
2018-04-19 10:26:39 +00:00
DetailStore.Effects
2018-04-06 11:02:18 +00:00
];
export const selectInfraState = createFeatureSelector<State>(MODULE.name);
export const ListSelector = new StateSelector<ListStore.State>(createSelector(
selectInfraState,
(state: State) => state.list
));
2018-04-19 10:26:39 +00:00
export const DetailSelector = new StateSelector<DetailStore.State>(createSelector(
selectInfraState,
(state: State) => state.sensor
));