From ac4a4a96e87e04742b827bee62bca8ee2307d30d Mon Sep 17 00:00:00 2001 From: Davide Grilli Date: Thu, 3 Sep 2026 14:22:11 +0200 Subject: [PATCH] =?UTF-8?q?Blocca=20il=20salvataggio=20se=20il=20numero=20?= =?UTF-8?q?di=20maglia=20=C3=A8=20gi=C3=A0=20assegnato?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Prima era solo un warning e il salvataggio procedeva comunque, generando doppioni non voluti in rosa. --- src/routes/admin.tsx | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/src/routes/admin.tsx b/src/routes/admin.tsx index 2049a5a..dcbd4c3 100644 --- a/src/routes/admin.tsx +++ b/src/routes/admin.tsx @@ -135,7 +135,8 @@ function ModificaGiocatore({ g, profilo }: { g: GiocatoreSquadra; profilo: Profi return; } if (numeroGiaUsato(righe, g.id, squadraCorrente.numero)) { - toast.warning(`Il numero ${squadraCorrente.numero} è già assegnato a un altro giocatore.`); + toast.error(`Il numero ${squadraCorrente.numero} è già assegnato a un altro giocatore.`); + return; } try { await salvaSquadra.mutateAsync({ giocatoreId: g.id, dati: squadraCorrente }); @@ -493,7 +494,8 @@ function AggiungiGiocatore({ righe }: { righe: GiocatoreSquadra[] }) { return; } if (numeroGiaUsato(righe, "", dati.numero)) { - toast.warning(`Il numero ${dati.numero} è già assegnato a un altro giocatore.`); + toast.error(`Il numero ${dati.numero} è già assegnato a un altro giocatore.`); + return; } try { await aggiungi.mutateAsync({ id: prossimoIdGiocatore(righe), dati });