main.ts 1.05 KB
Newer Older
1
2
3
4
5
6
7
8
import { Component, Inject, OnInit, OnDestroy }
 from '@angular/core';
import {
  Router,
  ActivatedRoute,
}
 from '@angular/router';
import './globalstyles.css';
9
10
11
12
13
import { DevToolsExtension, NgRedux, select } from 'ng2-redux';
import {
  IAppState,
  rootReducer,
  middleware,
14
//  enhancers,
15
} from '../store';
16
// import { reimmutify } from '../store';
17

18
19
20
21

@Component({
  selector: 'main',
  template: `
22
23
24
25
  <reg-header></reg-header>
  <reg-navbar></reg-navbar>
  <reg-main></reg-main>
  <reg-footer></reg-footer>
26
27
28
29
30
31
32
  `
})
export default class Main {
  public path: string = '';

  constructor(
    private router: Router,
33
34
35
    private activatedRoute: ActivatedRoute,
    private _ngRedux: NgRedux<IAppState>,
    private _devTools: DevToolsExtension
36
37
38
39
40
  ) {
    router.events.subscribe((data) => {
      this.path = data.url.substr(1);
    });

41
42

    const tools = _devTools.enhancer({
43
44
//      deserializeState: reimmutify,
  });
45
46
47
48
49
50
51
    _ngRedux.configureStore(
      rootReducer,
      {},
      middleware,
//      tools ? [ ...enhancers, tools ] : enhancers);
      tools);
  }
52
}