From faeb48bc6af354c54e60352dfdd3b0358a7f1d40 Mon Sep 17 00:00:00 2001 From: Emil Abraham Date: Mon, 29 Apr 2019 14:38:50 -0400 Subject: [PATCH] modified isLoggedIn function to check for auth token, log in page now removes auth token on init --- src/app/authentication/authentication.component.ts | 1 + src/app/header/header.component.ts | 2 +- 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/src/app/authentication/authentication.component.ts b/src/app/authentication/authentication.component.ts index d7072d7..e602c8e 100644 --- a/src/app/authentication/authentication.component.ts +++ b/src/app/authentication/authentication.component.ts @@ -54,6 +54,7 @@ export class AuthenticationComponent implements OnInit { localStorage.removeItem('gen_name'); localStorage.removeItem('data_type'); localStorage.removeItem('fault_type'); + localStorage.removeItem('auth_token'); } } diff --git a/src/app/header/header.component.ts b/src/app/header/header.component.ts index 9c640f5..20b222c 100644 --- a/src/app/header/header.component.ts +++ b/src/app/header/header.component.ts @@ -25,7 +25,7 @@ export class HeaderComponent implements OnInit { } isLoggedIn() { - if(this.router.url != '/' && this.router.url != '/#') + if(localStorage.getItem('auth_token')) { return true; }