import {Component, Input, Output, EventEmitter, ViewChild, ElementRef} from '@angular/core';
import {Observable} from 'rxjs/Observable';
import {ActivatedRoute, Router} from '@angular/router';
import {Location} from '@angular/common';
import {ErrorCodes} from '../utils/properties/errorCodes';
import {RouterHelper} from '../utils/routerHelper.class';
import {Session} from '../login/utils/helper.class';
@Component({
selector: 'reload',
template: `
`
})
export class ReloadComponent {
constructor (private element: ElementRef,
private route: ActivatedRoute,
private _router: Router,
private location: Location
) {
}
public ngOnInit() {
if (typeof document !== 'undefined') {
this.element.nativeElement.scrollIntoView();
}
var url = Session.getCurrentUrl();
if(url && url != null && url != ""){
Session.setCurrentUrl("");
var paramsObject = Session.getCurrentParameters();
Session.setCurrentParameters("");
if(paramsObject && paramsObject != null){
this._router.navigate([url],{ queryParams: paramsObject});
}else{
this._router.navigate([url]);
}
}else{
this._router.navigate(['/']);
}
}
}