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

39 lines
953 B
TypeScript
Raw Normal View History

2018-04-06 11:02:18 +00:00
import {
createSelector,
createFeatureSelector,
ActionReducerMap,
} from '@ngrx/store';
import { StateSelector } from 'packages/core/ngrx/store';
import { MODULE } from '../notification.constant';
import * as ListStore from './list';
import * as DetailStore from './detail';
export interface State {
notifications: ListStore.State;
notification: DetailStore.State;
}
export const REDUCERS = {
notifications: ListStore.reducer,
notification: DetailStore.reducer,
};
export const EFFECTS = [
ListStore.Effects,
DetailStore.Effects,
];
export const selectNotificationState = createFeatureSelector<State>(MODULE.name);
export const ReadAllByMemberSelector = new StateSelector<ListStore.State>(createSelector(
selectNotificationState,
(state: State) => state.notifications
));
export const ReadSelector = new StateSelector<DetailStore.State>(createSelector(
selectNotificationState,
(state: State) => state.notification
));