header.component.ts 1.3 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556
  1. import { AuthServiceService } from './../../shared/auth-service.service';
  2. import { Component, OnInit, LOCALE_ID, Inject } from '@angular/core';
  3. import { Router } from '@angular/router';
  4. import * as moment from 'moment';
  5. import {NgbModule} from '@ng-bootstrap/ng-bootstrap';
  6. import { UserService } from '../../shared/user.service';
  7. @Component({
  8. selector: 'app-header',
  9. templateUrl: './header.component.html',
  10. styleUrls: ['./header.component.css']
  11. })
  12. export class HeaderComponent implements OnInit {
  13. imgSrc: string = '../../../assets/image';
  14. constructor(private authSer: AuthServiceService ,
  15. private userSer: UserService,
  16. private router: Router) { }
  17. ngOnInit() {
  18. this.authSer.showHeaderLogin = true;
  19. this.authSer.showHeaderDashBoard = false;
  20. const m = moment().format('iYYYY/iM/iD');
  21. console.log(m);
  22. this.userSer.getUserDataProfile();
  23. console.log();
  24. }
  25. onGetProfile() {
  26. console.log('profile/' + this.authSer.dataLoginUser['id']);
  27. this.router.navigate(['profile/' + this.authSer.dataLoginUser['id']]);
  28. }
  29. //log out function
  30. onLogout() {
  31. localStorage.clear();
  32. //localStorage.setItem('token' , '');
  33. this.router.navigate(['login']);
  34. }
  35. onInternalPage() {
  36. this.router.navigate(['/InternalPage/home']);
  37. }
  38. }