From 5bcfd8d7bfc42fae6b71cc0a87933bd732c78721 Mon Sep 17 00:00:00 2001 From: Art Date: Sun, 12 Sep 2021 12:34:25 +0300 Subject: [PATCH] 105. Load token from local storage (#12) --- .../src/app/service/authentication.service.ts | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/support-portal-frontend/src/app/service/authentication.service.ts b/support-portal-frontend/src/app/service/authentication.service.ts index 832ef43..72d0bda 100644 --- a/support-portal-frontend/src/app/service/authentication.service.ts +++ b/support-portal-frontend/src/app/service/authentication.service.ts @@ -44,6 +44,10 @@ export class AuthenticationService { this.storage.setItem(JWT_TOKEN_STORAGE_KEY, token); } + public loadToken(): void { + this.token = this.storage.getItem(JWT_TOKEN_STORAGE_KEY); + } + public addUserToLocalStorage(user: User) { this.storage.setItem(USER_STORAGE_KEY, JSON.stringify(user)); }