Added my-account page with logout functionality
This commit is contained in:
@@ -6,10 +6,10 @@
|
||||
</div>
|
||||
<ul class="navigation__list msfa__hide-on-print">
|
||||
<li *ngIf="user" class="navigation__item">
|
||||
<div class="navigation__user">
|
||||
<a routerLink="/mitt-konto" class="navigation__link">
|
||||
<msfa-icon [icon]="iconType.USER" size="l"></msfa-icon>
|
||||
<span class="navigation__text">{{ user.fullName }}</span>
|
||||
</div>
|
||||
</a>
|
||||
</li>
|
||||
<li class="navigation__item">
|
||||
<a routerLink="/" class="navigation__link">
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
import { HttpClient } from '@angular/common/http';
|
||||
import { Injectable } from '@angular/core';
|
||||
import { Router } from '@angular/router';
|
||||
import { environment } from '@msfa-environment';
|
||||
import { AuthenticationResponse } from '@msfa-models/api/authentication.response.model';
|
||||
import { Authentication, mapAuthApiResponseToAuthenticationResult } from '@msfa-models/authentication.model';
|
||||
@@ -69,7 +70,7 @@ export class AuthenticationService {
|
||||
return this._token$.getValue();
|
||||
}
|
||||
|
||||
constructor(private httpClient: HttpClient) {
|
||||
constructor(private httpClient: HttpClient, private router: Router) {
|
||||
const localStorageData = this._getLocalStorageData();
|
||||
|
||||
if (localStorageData) {
|
||||
@@ -82,7 +83,9 @@ export class AuthenticationService {
|
||||
localStorage.removeItem('id_token');
|
||||
localStorage.removeItem('expires_at');
|
||||
|
||||
if (environment.environment !== 'local') {
|
||||
if (environment.environment === 'local') {
|
||||
void this.router.navigateByUrl(environment.logoutUrl);
|
||||
} else {
|
||||
document.location.href = environment.logoutUrl;
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user