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

43 lines
953 B
TypeScript
Raw Normal View History

2018-04-06 11:02:18 +00:00
import {
createSelector,
createFeatureSelector,
ActionReducerMap,
Selector,
} 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 '../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
));