Ignore:
Timestamp:
11/16/20 03:55:10 (4 years ago)
Author:
DimitarSlezenkovski <dslezenkovski@…>
Branches:
master
Children:
db484c9
Parents:
8b13eb2
Message:

Fix bugs, add some more.

Location:
Farmatiko/ClientApp/src/app/nav-menu
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • Farmatiko/ClientApp/src/app/nav-menu/nav-menu.component.html

    r8b13eb2 r8e74e2f  
    2626            <a class="nav-link text-dark" [routerLink]="['/koronavirus']">Коронавирус</a>
    2727          </li>
     28          <li *ngIf="loggedIn">
     29            <button mat-button [matMenuTriggerFor]="menu"><mat-icon>more_vert</mat-icon></button>
     30            <mat-menu #menu="matMenu">
     31              <button mat-menu-item [routerLink]="['/dashboard']"><mat-icon>dashboard</mat-icon>Контролна табла</button>
     32              <button mat-menu-item (click)="logout()"><mat-icon>exit_to_app</mat-icon>Одјави се</button>
     33            </mat-menu>
     34          </li>
    2835        </ul>
    2936      </div>
  • Farmatiko/ClientApp/src/app/nav-menu/nav-menu.component.ts

    r8b13eb2 r8e74e2f  
    1 import { Component } from '@angular/core';
     1import { Component, OnInit } from '@angular/core';
     2import { AuthService } from '../shared/services/auth.service';
    23
    34@Component({
     
    67  styleUrls: ['./nav-menu.component.css']
    78})
    8 export class NavMenuComponent {
     9export class NavMenuComponent implements OnInit {
    910  isExpanded = false;
     11  loggedIn: boolean = false;
     12
     13  constructor(private authService: AuthService) {
     14   
     15  }
     16 
     17  ngOnInit(): void {
     18    if(localStorage.getItem('access_token')) {
     19      this.loggedIn = true;
     20    }
     21  }
     22
     23  logout() {
     24    this.authService.logout();
     25  }
    1026
    1127  collapse() {
Note: See TracChangeset for help on using the changeset viewer.