43 lines
952 B
TypeScript
43 lines
952 B
TypeScript
|
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
|
||
|
));
|