40 lines
1.1 KiB
TypeScript
40 lines
1.1 KiB
TypeScript
import {Component} from '@angular/core';
|
|
import {Router} from '@angular/router';
|
|
import {LoginService} from './services/login-service/login-service';
|
|
import {PromotionService} from "./services/promotion-service/promotion.service";
|
|
import {AwardingService} from "./services/awarding-service/awarding.service";
|
|
import {RouteConfig} from "./app.config";
|
|
|
|
@Component({
|
|
selector: 'app-root',
|
|
templateUrl: 'app.component.html',
|
|
styleUrls: ['app.component.css']
|
|
})
|
|
export class AppComponent {
|
|
|
|
config = RouteConfig;
|
|
|
|
constructor(private loginService: LoginService,
|
|
private promotionService: PromotionService,
|
|
private awardingService: AwardingService,
|
|
private router: Router) {
|
|
}
|
|
|
|
|
|
ngOnInit() {
|
|
if (this.loginService.hasPermission(2)) {
|
|
const fraction = this.loginService.getCurrentUser().squad.fraction;
|
|
this.promotionService.checkUnconfirmedPromotions(fraction);
|
|
this.awardingService.checkUnprocessedAwards(fraction);
|
|
}
|
|
}
|
|
|
|
logout() {
|
|
this.loginService.logout();
|
|
this.router.navigate([RouteConfig.overviewPath]);
|
|
return false;
|
|
}
|
|
|
|
}
|
|
|