Skip to content
This repository was archived by the owner on Aug 29, 2022. It is now read-only.

Commit ffbca58

Browse files
Nishant ShukeNishant Shuke
authored andcommitted
Route Tweaks
1 parent 66f5d8c commit ffbca58

File tree

2 files changed

+12
-8
lines changed

2 files changed

+12
-8
lines changed

ui-trainer/src/app/app.component.ts

Lines changed: 11 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -17,9 +17,9 @@ export class AppComponent {
1717
loggedIn = false;
1818

1919
constructor(private matIconRegistry: MatIconRegistry,
20-
private domSanitizer: DomSanitizer,
21-
private route: ActivatedRoute,
22-
private router: Router, public authService: AuthService) {
20+
private domSanitizer: DomSanitizer,
21+
private route: ActivatedRoute,
22+
private router: Router, public authService: AuthService) {
2323
this.matIconRegistry.addSvgIcon(
2424
'project',
2525
this.domSanitizer.bypassSecurityTrustResourceUrl('../assets/images/project.svg')
@@ -120,8 +120,12 @@ export class AppComponent {
120120
if (!this.authService.isTokenExpired()) {
121121
this.loggedIn = true;
122122
if (localStorage.getItem('jwt_token') === 'no_token' && window.location.href.split('/').pop() !== 'applications' && window.location.href.split('/').pop() !== 'home' && window.location.href.split('/').pop() !== '') {
123-
sessionStorage.setItem('appParamExists', 'Y');
124-
this.router.navigate(['applications', { app : window.location.href.split('/').pop() }]);
123+
if (window.location.href.split('/').slice(-2)[0] !== 'home' && window.location.href.split('/').slice(-2)[0] !== 'conversations' && window.location.href.split('/').slice(-2)[0] !== 'trainer') {
124+
sessionStorage.setItem('appParamExists', 'Y');
125+
this.router.navigate(['applications', { app: window.location.href.split('/').pop() }]);
126+
} else {
127+
sessionStorage.setItem('appParamExists', 'N');
128+
}
125129
} else {
126130
sessionStorage.setItem('appParamExists', 'N');
127131
this.router.navigate(['applications']);
@@ -131,9 +135,9 @@ export class AppComponent {
131135
}
132136
}
133137

134-
callParentApp () {
138+
callParentApp() {
135139
localStorage.clear();
136-
let url = environment.PARENT_APP_URL;
140+
let url = environment.PARENT_APP_URL;
137141
window.open(url, '_self');
138142
}
139143
}

ui-trainer/src/app/home/home.component.html

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
<div *ngIf="appParamExists" class="header-full-height">
1+
<div *ngIf="!appParamExists" class="header-full-height">
22
<app-header></app-header>
33
</div>
44
<div class="trainer-full-height">

0 commit comments

Comments
 (0)