Skip to content

Commit

Permalink
Added router store
Browse files Browse the repository at this point in the history
  • Loading branch information
alcfeoh committed Jun 5, 2018
1 parent 8043bb1 commit 1c0b535
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 3 deletions.
4 changes: 3 additions & 1 deletion src/app/app.module.ts
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ import { StoreDevtoolsModule } from '@ngrx/store-devtools';
import { environment } from '../environments/environment';
import { EffectsModule } from '@ngrx/effects';
import { CurrentConditionsEffects } from './effects/current-conditions.effects';
import { routerReducer, StoreRouterConnectingModule } from '@ngrx/router-store';

@NgModule({
declarations: [
Expand All @@ -34,7 +35,8 @@ import { CurrentConditionsEffects } from './effects/current-conditions.effects';
routing,
StoreModule.forRoot(reducers, { metaReducers }),
!environment.production ? StoreDevtoolsModule.instrument() : [],
EffectsModule.forRoot([CurrentConditionsEffects])
EffectsModule.forRoot([CurrentConditionsEffects]),
StoreRouterConnectingModule.forRoot({stateKey: 'router'})
],
providers: [WeatherService],
bootstrap: [AppComponent]
Expand Down
7 changes: 5 additions & 2 deletions src/app/reducers/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,15 +9,18 @@ import { environment } from '../../environments/environment';
import {reducer as zipCodeReducer} from './zip-codes.reducer';
import {State as ZipCodeState} from './zip-codes.reducer';
import {currentConditionsReducer, CurrentConditionsState} from './current-conditions.reducer';
import {routerReducer, RouterReducerState} from '@ngrx/router-store';

export interface State {
zipcodes: ZipCodeState,
currentConditions: CurrentConditionsState
currentConditions: CurrentConditionsState,
router: RouterReducerState
}

export const reducers: ActionReducerMap<State> = {
zipcodes: zipCodeReducer,
currentConditions: currentConditionsReducer
currentConditions: currentConditionsReducer,
router: routerReducer
};


Expand Down

0 comments on commit 1c0b535

Please sign in to comment.