Project

General

Profile

1
import {Component, Input, Output, EventEmitter, ViewChild, ElementRef} from '@angular/core';
2
import {Observable}       from 'rxjs/Observable';
3
import {ActivatedRoute, Router} from '@angular/router';
4
import {Location} from '@angular/common';
5

    
6
import {OpenaireProperties} from '../utils/properties/openaireProperties';
7
import {ErrorCodes} from '../utils/properties/openaireProperties';
8
import {RouterHelper} from '../utils/routerHelper.class';
9
import {Session} from '../login/utils/helper.class';
10

    
11
@Component({
12
    selector: 'reload',
13
    template: `
14
    <div id="tm-main" class=" uk-section  uk-margin-small-top tm-middle"   >
15
      <div uk-grid uk-grid>
16
       <div class="tm-main uk-width-1-1@s uk-width-1-1@m  uk-width-1-1@l uk-row-first ">
17
          <div class="uk-container uk-margin-top publication">
18
            Go to initial page....
19
          </div>
20
        </div>
21
      </div>
22
    </div>
23
     `
24
})
25
export class ReloadComponent {
26

    
27
  constructor (private element: ElementRef,
28
    private route: ActivatedRoute,
29
      private _router: Router,
30
       private location: Location
31
    ) {
32

    
33
   }
34

    
35
  public ngOnInit() {
36
    if (typeof document !== 'undefined') {
37
      this.element.nativeElement.scrollIntoView();
38
    }
39
        var url = Session.getCurrentUrl();
40
        if(url && url != null && url != ""){
41
          Session.setCurrentUrl("");
42
          var paramsObject = Session.getCurrentParameters();
43
          Session.setCurrentParameters("");
44
          if(paramsObject &&  paramsObject != null){
45
            this._router.navigate([url],{ queryParams: paramsObject});
46
          }else{
47
            this._router.navigate([url]);
48
          }
49
        }else{
50
          this._router.navigate(['/']);
51

    
52
        }
53
  }
54

    
55
}
(2-2/3)