diff --git a/support-portal-frontend/src/app/service/authentication.service.ts b/support-portal-frontend/src/app/service/authentication.service.ts index 789b9ac..4df7ab2 100644 --- a/support-portal-frontend/src/app/service/authentication.service.ts +++ b/support-portal-frontend/src/app/service/authentication.service.ts @@ -10,6 +10,8 @@ import {User} from "../model/user"; }) export class AuthenticationService { + private readonly JWT_TOKEN_STORAGE_KEY = "jwt-token"; + private host: string = environment.apiUrl; private token: string | null; private loggedInUser: string | null; @@ -31,8 +33,14 @@ export class AuthenticationService { public logout(): void { this.token = null; this.loggedInUser = null; - this.storage.removeItem("jwt-token"); + this.storage.removeItem(this.JWT_TOKEN_STORAGE_KEY); this.storage.removeItem("user"); this.storage.removeItem("users"); } + + public saveToken(token: string): void { + this.token = token; + this.storage.setItem(this.JWT_TOKEN_STORAGE_KEY, token); + } + }