SES-145 Tables in GM screen are now connected to backend #67
@ -1,38 +1,48 @@
|
||||
import { Component, OnInit } from '@angular/core';
|
||||
import {CharacterStatsViewModel} from "../../../types/viewmodels/character-viewmodels/CharacterStatsViewModel";
|
||||
import {Store} from "@ngrx/store";
|
||||
import {AppState} from "../../store/models/app-state.model";
|
||||
import {CharacterService} from "../../../services/character.service";
|
||||
import {first} from "rxjs/operators";
|
||||
import {ErrorResponse} from "../../../types/ErrorResponse";
|
||||
import {HttpErrorResponse} from "@angular/common/http";
|
||||
import { CharacterStatsViewModel } from '../../../types/viewmodels/character-viewmodels/CharacterStatsViewModel';
|
||||
import { Store } from '@ngrx/store';
|
||||
import { AppState } from '../../store/models/app-state.model';
|
||||
import { CharacterService } from '../../../services/character.service';
|
||||
import { first } from 'rxjs/operators';
|
||||
import { ErrorResponse } from '../../../types/ErrorResponse';
|
||||
import { HttpErrorResponse } from '@angular/common/http';
|
||||
|
||||
@Component({
|
||||
selector: 'app-abilities',
|
||||
templateUrl: './abilities.component.html',
|
||||
styleUrls: ['./abilities.component.css']
|
||||
styleUrls: ['./abilities.component.css'],
|
||||
})
|
||||
export class AbilitiesComponent implements OnInit {
|
||||
characterStats: CharacterStatsViewModel[];
|
||||
|
||||
constructor(private store: Store<AppState>, private characterService: CharacterService) {}
|
||||
constructor(
|
||||
private store: Store<AppState>,
|
||||
private characterService: CharacterService
|
||||
) {}
|
||||
|
||||
ngOnInit() {
|
||||
this.getCharacterStats();
|
||||
}
|
||||
|
||||
getCharacterStats() {
|
||||
this.store.select( s => s.playerStore.characterId).pipe(first()).subscribe((characterId) => {
|
||||
this.characterService.getCharacterStats(characterId).pipe(first()).subscribe((characterStats) => {
|
||||
console.log(characterStats)
|
||||
this.store
|
||||
.select((s) => s.playerStore.characterId)
|
||||
.pipe(first())
|
||||
.subscribe((characterId) => {
|
||||
this.characterService
|
||||
.getCharacterStats(characterId)
|
||||
.pipe(first())
|
||||
.subscribe(
|
||||
(characterStats) => {
|
||||
this.characterStats = characterStats;
|
||||
}, (error: ErrorResponse | HttpErrorResponse) => {
|
||||
},
|
||||
(error: ErrorResponse | HttpErrorResponse) => {
|
||||
if (error instanceof HttpErrorResponse) {
|
||||
error = error.error as ErrorResponse;
|
||||
}
|
||||
console.error(error.message);
|
||||
}
|
||||
);
|
||||
});
|
||||
})
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -32,7 +32,6 @@ export class GameMasterArmorsTableComponent implements OnInit {
|
||||
.pipe(first())
|
||||
.subscribe(
|
||||
(result) => {
|
||||
console.log(result);
|
||||
this.dataSource = new MatTableDataSource(result);
|
||||
|
||||
this.dataSource.paginator = this.paginator;
|
||||
this.dataSource.sort = this.sort;
|
||||
|
@ -32,7 +32,6 @@ export class GameMasterWeaponsTableComponent implements OnInit {
|
||||
.pipe(first())
|
||||
.subscribe(
|
||||
(result) => {
|
||||
console.log(result);
|
||||
this.dataSource = new MatTableDataSource(result);
|
||||
s426128
commented
możesz usunąć console.log możesz usunąć console.log
|
||||
this.dataSource.paginator = this.paginator;
|
||||
this.dataSource.sort = this.sort;
|
||||
|
Loading…
Reference in New Issue
Block a user
możesz usunąć console.log