Fix critical issue with root path

This commit is contained in:
George Kalampokis 2020-05-27 19:08:02 +03:00
parent 6cc77468c5
commit 20d0d8b648
1 changed files with 16 additions and 7 deletions

View File

@ -15,6 +15,8 @@ import { CookieService } from "ngx-cookie-service";
import { LanguageService } from './core/services/language/language.service';
import { ConfigurationService } from './core/services/configuration/configuration.service';
import { Location } from '@angular/common';
declare const gapi: any;
declare var $: any;
@ -30,7 +32,7 @@ export class AppComponent implements OnInit {
sideNavOpen = false;
helpContentEnabled: boolean;
private statusChangeSubscription: Subscription;
onlySplash = true;
onlySplash = false;
constructor(
private router: Router,
@ -43,7 +45,8 @@ export class AppComponent implements OnInit {
private cookieService: CookieService,
private ccService: NgcCookieConsentService,
private language: LanguageService,
private configurationService: ConfigurationService
private configurationService: ConfigurationService,
private location: Location
) {
this.initializeServices();
this.helpContentEnabled = configurationService.helpService.enabled;
@ -58,12 +61,18 @@ export class AppComponent implements OnInit {
}
ngOnInit() {
if (!this.configurationService.useSplash) {
this.onlySplash = false;
this.router.navigate(['/reload']).then(() => this.router.navigate(['/home']));
} else {
if (this.location.path() === '') {
if (!this.configurationService.useSplash) {
this.onlySplash = false;
this.router.navigate(['/reload']).then(() => this.router.navigate(['/home']));
} else {
this.onlySplash = true;
this.router.navigate(['/reload']).then(() => this.router.navigate(['/splash']));
}
} else if (this.location.path() === '/splash') {
this.onlySplash = true;
this.router.navigate(['/reload']).then(() => this.router.navigate(['/splash']));
} else {
this.onlySplash = false;
}
if (!this.cookieService.check("cookiesConsent")) {
this.cookieService.set("cookiesConsent", "false", 356);