|
|
import { Component, Inject, OnInit } from '@angular/core'; |
|
|
import { AuthService } from './auth/auth.service'; |
|
|
import { BrandService } from './shared/brand.service'; |
|
|
import { Title } from '@angular/platform-browser'; |
|
|
import { DOCUMENT } from '@angular/common'; |
|
|
|
|
|
@Component({ |
|
|
selector: 'app-root', |
|
|
templateUrl: './app.component.html', |
|
|
styleUrl: './app.component.css' |
|
|
}) |
|
|
export class AppComponent implements OnInit { |
|
|
constructor( |
|
|
private authService: AuthService, |
|
|
public brandService: BrandService, |
|
|
private titleService: Title, |
|
|
@Inject(DOCUMENT) private document: Document |
|
|
) { } |
|
|
title = 'Py-Learn'; |
|
|
|
|
|
ngOnInit(): void { |
|
|
|
|
|
this.titleService.setTitle(this.brandService.name); |
|
|
|
|
|
|
|
|
const favicon: HTMLLinkElement | null = this.document.querySelector("link[rel*='icon']"); |
|
|
if (favicon) { |
|
|
favicon.href = this.brandService.name === 'Py-Learn' |
|
|
? 'assets/favicon.png' |
|
|
: 'assets/majema-favicon.png'; |
|
|
} |
|
|
|
|
|
this.authService.checkSession().subscribe((status) => { |
|
|
if (status) { |
|
|
this.authService.startAutoRefresh(); |
|
|
} |
|
|
}); |
|
|
} |
|
|
} |
|
|
|