import { Router } from '@angular/router'; import { InternalPageService } from './../../shared/internal-page.service'; import { UserService } from './../../shared/user.service'; import { AuthServiceService } from './../../shared/auth-service.service'; import { Component, OnInit } from '@angular/core'; @Component({ selector: 'app-internal-page-header', templateUrl: './internal-page-header.component.html', styleUrls: ['./internal-page-header.component.css'] }) export class InternalPageHeaderComponent implements OnInit { constructor(private authSer: AuthServiceService, private userservice: UserService, private internalService: InternalPageService, private router: Router) { } parentsPage = []; currentDate: number = Date.now(); ngOnInit() { this.authSer.arabicTemplate = true; this.authSer.arabicLanguage = true; this.authSer.englishLanguage = false; console.log('tooooken', this.authSer.isAuthenticated()); this.internalService.getParentData().subscribe( (responce) => { this.parentsPage = responce['parents']; console.log('parents pageees', this.parentsPage); }, (error) => { console.log(error); } ); //this.spinner.show(); this.authSer.showDashboardHeader = false; this.internalService.getParentData(); //console.log(this.checkTokenExpire); //get profile data this.userservice.getUserDataProfile(); this.currentDate = this.authSer.writeHijri(new Date(this.currentDate), 'ar'); } onLogin() { this.router.navigate(['/login']); } onGetProfile() { console.log('profile/' + this.authSer.dataLoginUser['id']); this.router.navigate(['profile/' + this.authSer.dataLoginUser['id']]); } //log out function onLogout() { localStorage.clear(); this.router.navigate(['login']); } onDashBoard() { this.router.navigate(['dashboard/' + this.authSer.dataLoginUser['id']]); } goToHome() { this.router.navigate(['InternalPage/home']); } }