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

38 lines
759 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';
2018-05-27 14:17:07 +00:00
import * as SensorEntityStore from './entity/sensor';
2018-04-06 11:02:18 +00:00
export interface State {
2018-05-27 14:17:07 +00:00
sensor: SensorEntityStore.State;
2018-04-06 11:02:18 +00:00
}
export const REDUCERS = {
2018-05-27 14:17:07 +00:00
sensor: SensorEntityStore.reducer,
2018-04-06 11:02:18 +00:00
};
export const EFFECTS = [
2018-05-27 14:17:07 +00:00
SensorEntityStore.Effects,
2018-04-06 11:02:18 +00:00
];
2018-05-27 14:17:07 +00:00
export const selectState = createFeatureSelector<State>(MODULE.name);
2018-04-06 11:02:18 +00:00
2018-05-27 14:17:07 +00:00
export const SensorEntitySelector = SensorEntityStore.getSelectors(createSelector(
selectState,
2018-04-06 11:02:18 +00:00
(state: State) => state.sensor
));
2018-05-27 14:17:07 +00:00
export const SensorPageSelector = createSelector(
selectState,
(state: State) => state.sensor.page
);