2019-09-18 06:02:21 +00:00
|
|
|
import { Type } from '@angular/core';
|
|
|
|
import { Action, combineReducers, Selector, createSelector } from '@ngrx/store';
|
|
|
|
|
|
|
|
import * as AuthenticationStore from './authentication';
|
2019-09-24 05:53:22 +00:00
|
|
|
import * as PrivacyStore from './privacy';
|
2019-09-18 06:02:21 +00:00
|
|
|
|
|
|
|
export interface State {
|
|
|
|
authentication: AuthenticationStore.State;
|
2019-09-24 05:53:22 +00:00
|
|
|
privacy: PrivacyStore.State;
|
2019-09-18 06:02:21 +00:00
|
|
|
}
|
|
|
|
|
2019-09-24 05:53:22 +00:00
|
|
|
export const effects: Type<any>[] = [
|
|
|
|
AuthenticationStore.Effects,
|
|
|
|
PrivacyStore.Effects
|
|
|
|
];
|
2019-09-18 06:02:21 +00:00
|
|
|
|
|
|
|
export function reducers(state: State | undefined, action: Action) {
|
|
|
|
return combineReducers({
|
2019-09-24 05:53:22 +00:00
|
|
|
authentication: AuthenticationStore.reducer,
|
|
|
|
privacy: PrivacyStore.reducer
|
2019-09-18 06:02:21 +00:00
|
|
|
})(state, action);
|
|
|
|
}
|
|
|
|
|
|
|
|
export function selectors<S>(selector: Selector<any, State>) {
|
|
|
|
return {
|
|
|
|
AuthenticationSelector: AuthenticationStore.selectors(
|
|
|
|
createSelector(
|
|
|
|
selector,
|
|
|
|
(state: State) => state.authentication
|
|
|
|
)
|
2019-09-24 05:53:22 +00:00
|
|
|
),
|
|
|
|
PrivacySelector: PrivacyStore.selectors(
|
|
|
|
createSelector(
|
|
|
|
selector,
|
|
|
|
(state: State) => state.privacy
|
|
|
|
)
|
2019-09-18 06:02:21 +00:00
|
|
|
)
|
|
|
|
};
|
|
|
|
}
|