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

39 lines
954 B
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 '../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
));