56 lines
1.8 KiB
TypeScript
56 lines
1.8 KiB
TypeScript
import {Component, OnDestroy, OnInit} from '@angular/core';
|
|
import {ApiService} from "../../services/api.service";
|
|
import {Subject} from "rxjs";
|
|
import {takeUntil} from "rxjs/operators";
|
|
import {EventService} from "../../services/event.service";
|
|
import {TestingApiService} from "../../services/testing-api.service";
|
|
|
|
@Component({
|
|
selector: 'app-admin-testing',
|
|
templateUrl: './admin-testing.component.html',
|
|
styleUrls: ['./admin-testing.component.scss']
|
|
})
|
|
export class AdminTestingComponent implements OnInit, OnDestroy {
|
|
prodMode = false;
|
|
destroyed$ = new Subject<void>();
|
|
constructor(
|
|
private apiService: ApiService,
|
|
private eventService: EventService,
|
|
private testingApiService: TestingApiService) {
|
|
}
|
|
|
|
ngOnInit(): void {
|
|
this.getFFState();
|
|
this.eventService.featureFlagChanged.pipe(takeUntil(this.destroyed$)).subscribe((r) => this.getFFState());
|
|
}
|
|
|
|
private getFFState() {
|
|
this.apiService.getFeatureFlagState("ProdMode").pipe(takeUntil(this.destroyed$)).subscribe((res) =>
|
|
{
|
|
this.prodMode = res.state;
|
|
});
|
|
}
|
|
ngOnDestroy() {
|
|
this.destroyed$.complete();
|
|
}
|
|
|
|
simulateVersus() {
|
|
this.testingApiService.simulateVersus().pipe(takeUntil(this.destroyed$)).subscribe((r) => console.log(r));
|
|
}
|
|
|
|
resetAllVersusTasksAsIncompleted() {
|
|
this.testingApiService.resetAllVersusTasksAsIncompleted().pipe(takeUntil(this.destroyed$)).subscribe((r) => console.log(r));
|
|
}
|
|
|
|
resetAllPlayersScore() {
|
|
this.testingApiService.resetAllPlayersScore().pipe(takeUntil(this.destroyed$)).subscribe(r => console.log(r));
|
|
}
|
|
|
|
clearGameQueue() {
|
|
this.testingApiService.clearGameQueue().pipe(takeUntil(this.destroyed$)).subscribe((r => console.log(r)));
|
|
}
|
|
|
|
simulateEndGamePoints() {
|
|
this.testingApiService.simulateEndGamePoints().pipe(takeUntil(this.destroyed$)).subscribe(r => console.log(r));
|
|
}
|
|
}
|