Skip to content

Commit

Permalink
fix add not working issue
Browse files Browse the repository at this point in the history
  • Loading branch information
AnSch1510 committed Jul 28, 2024
1 parent d316c9a commit 98b674a
Showing 1 changed file with 8 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -190,22 +190,28 @@ export class EventTimeslotComponent {
}
}

protected async addPlayer(player: User) {
protected async addPlayer(userId: string) {
const eventId = this.eventId();
const timeslotId = this.timeslotId();

if (isNullish(eventId) || isNullish(timeslotId)) return;

const response = await this._eventService.patchPlayerEventRegistrations({
eventId,
body: { userId: player.id, timeslotId: timeslotId, isRegistered: true },
body: { userId: userId, timeslotId: timeslotId, isRegistered: true },
});
if (response.ok) {
this._messageService.add({
severity: 'success',
summary: this.translations.events_timeslot_playerAdded(),
life: 2000,
});
} else {
this._messageService.add({
severity: 'error',
summary: this.translations.events_timeslot_error_playerAdded(),
life: 2000,
});
}
}

Expand Down

0 comments on commit 98b674a

Please sign in to comment.