Also show friendly error toast if trying to take same team name as existing team name

This commit is contained in:
Kalle 2025-03-08 09:57:43 +02:00
parent 273b3dce9c
commit edf55abb9f

View File

@ -73,6 +73,12 @@ export const action: ActionFunction = async ({ request, params }) => {
tournament.registrationOpen || data.teamName === ownTeam.name,
"Can't change team name after registration has closed",
);
errorToastIfFalsy(
!tournament.ctx.teams.some(
(team) => team.name === data.teamName && team.id !== ownTeam.id,
),
"Team name already taken for this tournament",
);
await TournamentTeamRepository.update({
userId: user.id,