blob: c0909c12454c69977db8c84a52f498de717ec071 [file] [log] [blame]
Sonsino, Ofir (os0695)ff76b5e2018-07-10 15:57:37 +03001import { NgModule } from '@angular/core';
2import { NgReduxModule, NgRedux, DevToolsExtension } from '@angular-redux/store';
3import { RootEpics } from './epics';
4
5import rootReducer, {AppState} from "./reducers";
6import {AAIEpics} from "../services/aaiService/aai.epics";
7
8@NgModule({
9 imports: [NgReduxModule],
10 providers: [RootEpics, AAIEpics],
11})
12
13export class StoreModule {
14 constructor(
15 public store: NgRedux<AppState>,
16 devTools: DevToolsExtension,
17 rootEpics: RootEpics,
18 ) {
19
20 const persistedState = sessionStorage.getItem('reduxState') ?
21 JSON.parse(sessionStorage.getItem('reduxState')) : {};
22
23 store.configureStore(
24 rootReducer,
25 persistedState,
26 rootEpics.createEpics(),
27 devTools.isEnabled() ? [ devTools.enhancer() ] : []);
28 }
29}