From 2af851285c0a667c3956a4e49502ca498c142584 Mon Sep 17 00:00:00 2001 From: crusader Date: Tue, 23 Oct 2018 22:08:08 +0900 Subject: [PATCH] ing --- .../infra/display/display.component.ts | 2 +- src/app/store/discovery/index.ts | 18 +++++++++++++----- src/app/store/environment/index.ts | 18 +++++++++++++----- src/app/store/index.ts | 8 ++++---- src/app/store/infra/index.ts | 15 +++++++++++---- src/app/store/ui/index.ts | 16 ++++++++++++---- 6 files changed, 54 insertions(+), 23 deletions(-) diff --git a/src/app/component/infra/display/display.component.ts b/src/app/component/infra/display/display.component.ts index 0659db8..83fd930 100644 --- a/src/app/component/infra/display/display.component.ts +++ b/src/app/component/infra/display/display.component.ts @@ -24,7 +24,7 @@ import * as InfraStore from '../../../store/infra/infra'; styleUrls: ['./display.component.scss'] }) export class DisplayComponent implements OnInit, AfterContentInit, OnDestroy { - private infraDisplayType$: Observable; + infraDisplayType$: Observable; displaySidebar = false; selectedInfraSubscription: Subscription | null; diff --git a/src/app/store/discovery/index.ts b/src/app/store/discovery/index.ts index bf1b8e5..4d8db70 100644 --- a/src/app/store/discovery/index.ts +++ b/src/app/store/discovery/index.ts @@ -2,7 +2,8 @@ import { Type } from '@angular/core'; import { Selector, createSelector, - combineReducers + combineReducers, + compose } from '@ngrx/store'; import * as ConfigStore from './config'; @@ -19,10 +20,17 @@ export const EFFECTS: Type[] = [ RequestStore.RequestEffects, ]; -export const REDUCER = combineReducers({ - config: ConfigStore.reducer, - request: RequestStore.reducer, -}); +export function reducer(state: any, action: any) { + return combineReducers({ + config: ConfigStore.reducer, + request: RequestStore.reducer, + })(state, action); +} + +// export const REDUCER = combineReducers({ +// config: ConfigStore.reducer, +// request: RequestStore.reducer, +// }); export function getSelectors(selector: Selector) { return { diff --git a/src/app/store/environment/index.ts b/src/app/store/environment/index.ts index 1d4693c..ef55e33 100644 --- a/src/app/store/environment/index.ts +++ b/src/app/store/environment/index.ts @@ -2,7 +2,8 @@ import { Type } from '@angular/core'; import { Selector, createSelector, - combineReducers + combineReducers, + compose } from '@ngrx/store'; import * as InterfacesStore from './interfaces'; @@ -19,10 +20,17 @@ export const EFFECTS: Type[] = [ UserStore.UserEffects, ]; -export const REDUCER = combineReducers({ - interfaces: InterfacesStore.reducer, - user: UserStore.reducer, -}); +export function reducer(state: any, action: any) { + return combineReducers({ + interfaces: InterfacesStore.reducer, + user: UserStore.reducer, + })(state, action); +} + +// export const REDUCER = combineReducers({ +// interfaces: InterfacesStore.reducer, +// user: UserStore.reducer, +// }); export function getSelectors(selector: Selector) { return { diff --git a/src/app/store/index.ts b/src/app/store/index.ts index 04f615a..2385c39 100644 --- a/src/app/store/index.ts +++ b/src/app/store/index.ts @@ -24,10 +24,10 @@ export const EFFECTS: Type[] = [ export const REDUCERS: ActionReducerMap = { router: fromRouter.routerReducer, - discovery: DiscoveryStore.REDUCER, - environment: EnvironmentStore.REDUCER, - infra: InfraStore.REDUCER, - ui: UIStore.REDUCER, + discovery: DiscoveryStore.reducer, + environment: EnvironmentStore.reducer, + infra: InfraStore.reducer, + ui: UIStore.reducer, }; // console.log all actions diff --git a/src/app/store/infra/index.ts b/src/app/store/infra/index.ts index 7769e8e..e1bffce 100644 --- a/src/app/store/infra/index.ts +++ b/src/app/store/infra/index.ts @@ -2,7 +2,8 @@ import { Type } from '@angular/core'; import { Selector, createSelector, - combineReducers + combineReducers, + compose } from '@ngrx/store'; import * as InfraStore from './infra'; @@ -16,9 +17,15 @@ export const EFFECTS: Type[] = [ InfraStore.InfraEffects, ]; -export const REDUCER = combineReducers({ - infra: InfraStore.reducer, -}); +export function reducer(state: any, action: any) { + return combineReducers({ + infra: InfraStore.reducer, + })(state, action); +} + +// export const REDUCER = combineReducers({ +// infra: InfraStore.reducer, +// }); export function getSelectors(selector: Selector) { return { diff --git a/src/app/store/ui/index.ts b/src/app/store/ui/index.ts index adf01b6..411aa11 100644 --- a/src/app/store/ui/index.ts +++ b/src/app/store/ui/index.ts @@ -2,7 +2,8 @@ import { Type } from '@angular/core'; import { Selector, createSelector, - combineReducers + combineReducers, + compose } from '@ngrx/store'; import * as LayoutStore from './layout'; @@ -16,9 +17,16 @@ export const EFFECTS: Type[] = [ LayoutStore.LayoutEffects, ]; -export const REDUCER = combineReducers({ - layout: LayoutStore.reducer, -}); +export function reducer(state: any, action: any) { + return combineReducers({ + layout: LayoutStore.reducer, + })(state, action); +} + + +// export const REDUCER = combineReducers({ +// layout: LayoutStore.reducer, +// }); export function getSelectors(selector: Selector) { return {