1
0
Fork 0
mirror of https://codeberg.org/beerbrawl/beerbrawl.git synced 2024-09-23 13:50:53 +02:00

Merge branch 'fix/#110/fix-error-message-on-delete-team' into 'development'

fix(#110): fix error message on delete team

See merge request 2024ss-se-pr-group/24ss-se-pr-qse-11!68
This commit is contained in:
Moritz Kepplinger 2024-05-29 12:07:45 +00:00
commit 3755cee755
2 changed files with 8 additions and 9 deletions

View file

@ -1,4 +1,4 @@
import { Component, inject, input, output } from '@angular/core';
import { Component, input, output } from '@angular/core';
import {
MatCell,
MatCellDef,
@ -12,13 +12,10 @@ import {
MatTable,
} from '@angular/material/table';
import { NgClass, NgStyle } from '@angular/common';
import { QualificationTeamScoreDto, TeamDto, TournamentEndpointService } from '@api';
import { QualificationTeamScoreDto } from '@api';
import { MatIconButton } from '@angular/material/button';
import { MatIcon } from '@angular/material/icon';
import { MatTooltip } from '@angular/material/tooltip';
import { catchError, of } from 'rxjs';
import { ConfirmationService } from '../../services/confirmation.service';
import { MatSnackBar } from '@angular/material/snack-bar';
@Component({
selector: 'app-tournament-score-table',

View file

@ -21,6 +21,7 @@ import { MatChipsModule, MatChipTrailingIcon } from '@angular/material/chips';
import { TournamentTeamEditService } from 'src/app/services/tournament-team-edit-dialog.service';
import { MatCard } from '@angular/material/card';
import { RouterLink, RouterModule } from '@angular/router';
import { HttpErrorResponse } from '@angular/common/http';
@Component({
selector: 'app-tournament-teams',
@ -63,6 +64,7 @@ export class TournamentTeamsComponent implements OnInit {
this.loadTeams();
this.loadTournament();
}
loadTournament() {
if (this.tournamentId() !== undefined) {
this.tournamentService.get(this.tournamentId()!).subscribe({
@ -105,10 +107,10 @@ export class TournamentTeamsComponent implements OnInit {
this.tournamentService
.deleteTournamentTeam(this.tournamentId()!, team.id!)
.pipe(
catchError(error => {
console.error(error);
this.snackBar.open('Failed to load teams: ' + error.message, 'Close');
return of([]);
catchError((e: HttpErrorResponse) => {
console.error(e.error);
this.snackBar.open('Failed to load teams: ' + e.error, 'Close');
return [];
}),
)
.subscribe(() => {