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