Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 4 additions & 3 deletions src/app/LoggedInOutlet.ts
Original file line number Diff line number Diff line change
Expand Up @@ -14,14 +14,15 @@ export class LoggedInRouterOutlet extends RouterOutlet {
super(_elementRef, _loader, _parentRouter, nameAttr);

this.parentRouter = _parentRouter;
// The Boolean following each route below denotes whether the route requires authentication to view
this.publicRoutes = {
'/login': true,
'/signup': true
'login': true,
'signup': true
};
}

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