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

47 lines
1.3 KiB
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 '../probe.constant';
2018-05-25 12:41:29 +00:00
import * as ProbeEntityStore from './entity/probe';
import * as ProbeListContainerStore from './container/probe-list';
2018-05-26 09:08:40 +00:00
import * as ProbeDetailContainerStore from './container/probe-detail';
2018-04-06 11:02:18 +00:00
export interface State {
2018-05-27 06:52:27 +00:00
probe: ProbeEntityStore.State;
2018-05-25 12:52:50 +00:00
probe_list_container: ProbeListContainerStore.State;
2018-05-26 09:08:40 +00:00
probe_detail_container: ProbeDetailContainerStore.State;
2018-04-06 11:02:18 +00:00
}
export const REDUCERS = {
2018-05-27 06:52:27 +00:00
probe: ProbeEntityStore.reducer,
2018-05-25 12:52:50 +00:00
probe_list_container: ProbeListContainerStore.reducer,
2018-05-26 09:08:40 +00:00
probe_detail_container: ProbeDetailContainerStore.reducer
2018-04-06 11:02:18 +00:00
};
export const EFFECTS = [
2018-05-25 12:41:29 +00:00
ProbeEntityStore.Effects,
2018-04-06 11:02:18 +00:00
];
2018-05-25 11:59:18 +00:00
export const selectState = createFeatureSelector<State>(MODULE.name);
2018-04-06 11:02:18 +00:00
2018-05-25 12:41:29 +00:00
export const ProbeSelector = ProbeEntityStore.getSelectors(createSelector(
2018-05-25 11:59:18 +00:00
selectState,
2018-05-27 06:52:27 +00:00
(state: State) => state.probe
2018-04-25 09:04:47 +00:00
));
2018-05-24 11:30:02 +00:00
2018-05-25 12:52:50 +00:00
export const ProbeListContainerSelector = ProbeListContainerStore.getSelectors(createSelector(
selectState,
(state: State) => state.probe_list_container
));
2018-05-26 09:08:40 +00:00
export const ProbeDetailContainerSelector = ProbeDetailContainerStore.getSelectors(createSelector(
selectState,
(state: State) => state.probe_detail_container
));