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

43 lines
952 B
TypeScript
Raw Normal View History

2018-04-06 11:02:18 +00:00
import {
createSelector,
createFeatureSelector,
ActionReducerMap,
Selector,
} from '@ngrx/store';
import { StateSelector } from 'packages/core/ngrx/store';
import { MODULE } from '../discovery.constant';
import * as DiscoverStore from './discover';
import * as SettingStore from './setting';
export interface State {
discover: DiscoverStore.State;
setting: SettingStore.State;
}
export const REDUCERS = {
discover: DiscoverStore.reducer,
setting: SettingStore.reducer,
};
export const EFFECTS = [
SettingStore.Effects,
DiscoverStore.Effects,
];
export const selectDiscoveryState = createFeatureSelector<State>(MODULE.name);
export const DiscoverSelector = new StateSelector<DiscoverStore.State>(createSelector(
selectDiscoveryState,
(state: State) => state.discover
));
export const SettingSelector = new StateSelector<SettingStore.State>(createSelector(
selectDiscoveryState,
(state: State) => state.setting
));