File

src/app/Views/header/header.component.ts

Metadata

Index

Methods

Constructor

constructor(tokenStorage: TokenStorageService)
Parameters :
Name Type Optional
tokenStorage TokenStorageService No

Methods

logout
logout()
Returns : void
import { Component, OnInit } from '@angular/core';
import { TokenStorageService } from 'src/app/Services/token.service';

@Component({
  selector: 'app-header',
  templateUrl: './header.component.html',
  styleUrls: ['./header.component.scss'],
})
export class HeaderComponent {
  /**
   * @param  {TokenStorageService} privatetokenStorage
   */
  constructor(private tokenStorage: TokenStorageService) {}

  //logout() clears session storage; All user data is eradicated from it and page is reloaded
  logout() {
    this.tokenStorage.signOut();
    location.reload();
  }
}
<mat-toolbar>
  <a href=""><span>Aktienbot</span></a>
  <span class="example-spacer"></span>
  <button
    mat-icon-button
    aria-label="Example icon-button with heart icon"
    routerLink="/profile"
  >
    <mat-icon>account_circle</mat-icon>
  </button>
  <button
    mat-icon-button
    class="example-icon favorite-icon"
    routerLink="/settings"
  >
    <mat-icon>ballot</mat-icon>
  </button>
  <button
    mat-icon-button
    aria-label="Example icon-button with heart icon"
    (click)="logout()"
  >
    <mat-icon>logout</mat-icon>
  </button>
</mat-toolbar>

./header.component.scss

.example-spacer {
  flex: 1 1 auto;
}

a {
  color: white;
  text-decoration: none; /* no underline */
}
Legend
Html element
Component
Html element with directive

results matching ""

    No results matching ""