import { Component, OnInit, Input, Output, EventEmitter } from '@angular/core';
import { BehaviorSubject, Observable } from 'rxjs';
import { AuthenticationService } from 'src/app/service/authentication.service';
;

@Component({
  selector: 'app-menu',
  templateUrl: './menu.component.html',
  styleUrls: ['./menu.component.css']
})
export class MenuComponent implements OnInit {
titleAction$: Observable<string> | undefined;
titleChanged = new EventEmitter<string>();

  loggedInUser: any = {};

  constructor(private authenticationService: AuthenticationService) {}

  ngOnInit(): void {
    // Fetch user details from authentication service
    this.loggedInUser = this.authenticationService.getUserFromLocalStorage();
  }


  logout(){
    this.authenticationService.logout()
  }

 
  changeTitle(title: string): void {
    this.titleChanged.emit(title);
  }
}
