2019-04-24 14:31:01 +02:00
|
|
|
import {Component} from '@angular/core';
|
2017-12-19 13:53:46 +01:00
|
|
|
import {ActivatedRoute, Router} from '@angular/router';
|
|
|
|
import {Session} from '../login/utils/helper.class';
|
2019-04-24 14:31:01 +02:00
|
|
|
import {HelperFunctions} from "../utils/HelperFunctions.class";
|
2017-12-19 13:53:46 +01:00
|
|
|
|
|
|
|
@Component({
|
2020-09-23 12:15:39 +02:00
|
|
|
selector: 'reload',
|
|
|
|
template: `
|
2020-11-26 12:14:14 +01:00
|
|
|
<loading [full]="true"></loading>
|
2020-09-23 12:15:39 +02:00
|
|
|
`
|
2017-12-19 13:53:46 +01:00
|
|
|
})
|
|
|
|
export class ReloadComponent {
|
2020-09-23 12:15:39 +02:00
|
|
|
|
|
|
|
constructor(private route: ActivatedRoute, private _router: Router) {
|
|
|
|
}
|
|
|
|
|
2017-12-19 13:53:46 +01:00
|
|
|
public ngOnInit() {
|
2024-01-09 09:07:04 +01:00
|
|
|
let URL = Session.popReloadUrl();
|
2021-03-17 10:21:37 +01:00
|
|
|
if (URL && URL["path"] && URL["path"] != "") {
|
2021-03-11 18:40:25 +01:00
|
|
|
let url: string = URL["path"];
|
|
|
|
let host = URL["host"];
|
|
|
|
let paramsObject = ((URL["params"] && URL["params"] != null) ? Session.getParamsObj(URL["params"]) : null);
|
2020-09-23 12:15:39 +02:00
|
|
|
if (host == (location.protocol + "//" + location.host)) {
|
|
|
|
let baseUrl = (document && document.getElementsByTagName('base')) ? document.getElementsByTagName('base')[0].href.split(document.location.host)[1] : "/";
|
|
|
|
url = (baseUrl.length > 1 && url.indexOf(baseUrl) != -1) ? ("/" + url.split(baseUrl)[1]) : url;
|
|
|
|
if (paramsObject) {
|
2021-03-17 10:21:37 +01:00
|
|
|
if(URL['fragment'] && URL['fragment'] !== '') {
|
|
|
|
this._router.navigate([url], {queryParams: paramsObject, fragment: URL['fragment']});
|
2021-03-11 18:40:25 +01:00
|
|
|
} else {
|
|
|
|
this._router.navigate([url], {queryParams: paramsObject});
|
|
|
|
}
|
2020-09-23 12:15:39 +02:00
|
|
|
} else {
|
2021-03-17 10:21:37 +01:00
|
|
|
if(URL['fragment'] && URL['fragment'] !== '') {
|
|
|
|
this._router.navigate([url], {fragment: URL['fragment']});
|
2021-03-11 18:40:25 +01:00
|
|
|
} else {
|
|
|
|
this._router.navigate([url]);
|
|
|
|
}
|
2017-12-19 13:53:46 +01:00
|
|
|
}
|
2020-09-23 12:15:39 +02:00
|
|
|
} else {
|
|
|
|
window.location.href = host + url + ((URL["params"] && URL["params"] != null) ? ((URL["params"].indexOf("?") == -1 ? "?" : "") + URL["params"]) : "");
|
|
|
|
}
|
|
|
|
|
|
|
|
} else {
|
|
|
|
this._router.navigate(['/']);
|
|
|
|
}
|
2017-12-19 13:53:46 +01:00
|
|
|
}
|
2020-09-23 12:15:39 +02:00
|
|
|
|
2017-12-19 13:53:46 +01:00
|
|
|
}
|