Skip to content

Commit 91f67a3

Browse files
committed
Merge pull request auth0-blog#49 from MasterKale/master
Update LoggedInOutlet.ts
2 parents 0bb7148 + f2a7166 commit 91f67a3

File tree

1 file changed

+4
-3
lines changed

1 file changed

+4
-3
lines changed

src/app/LoggedInOutlet.ts

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -14,14 +14,15 @@ export class LoggedInRouterOutlet extends RouterOutlet {
1414
super(_elementRef, _loader, _parentRouter, nameAttr);
1515

1616
this.parentRouter = _parentRouter;
17+
// The Boolean following each route below denotes whether the route requires authentication to view
1718
this.publicRoutes = {
18-
'/login': true,
19-
'/signup': true
19+
'login': true,
20+
'signup': true
2021
};
2122
}
2223

2324
activate(instruction: ComponentInstruction) {
24-
var url = this.parentRouter.lastNavigationAttempt;
25+
let url = instruction.urlPath;
2526
if (!this.publicRoutes[url] && !localStorage.getItem('jwt')) {
2627
// todo: redirect to Login, may be there a better way?
2728
this.parentRouter.navigateByUrl('/login');

0 commit comments

Comments
 (0)