bugfixes
This commit is contained in:
parent
d2e5d7bde4
commit
c514141415
1 changed files with 7 additions and 3 deletions
|
|
@ -60,12 +60,16 @@ export class AppComponent {
|
||||||
.pipe(filter((event) => event instanceof NavigationEnd))
|
.pipe(filter((event) => event instanceof NavigationEnd))
|
||||||
.subscribe(() => {
|
.subscribe(() => {
|
||||||
const urlTree = this.router.parseUrl(this.router.url);
|
const urlTree = this.router.parseUrl(this.router.url);
|
||||||
|
const firstSegment = this.getFirstSegment(urlTree);
|
||||||
|
const allowedRoutes = ['pw-reset', 'register', 'forgot-pw', 'login'];
|
||||||
|
|
||||||
if (
|
if (!allowedRoutes.includes(firstSegment)) {
|
||||||
urlTree.root.children['primary']?.segments[0]?.path !== 'pw-reset'
|
|
||||||
) {
|
|
||||||
this.router.navigate(['/login']);
|
this.router.navigate(['/login']);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private getFirstSegment(urlTree: any): string {
|
||||||
|
return urlTree.root.children['primary']?.segments[0]?.path || '';
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue