Typscript final

This commit is contained in:
2026-03-11 16:44:09 +01:00 Verified
parent 42b28350de
commit edd9b064ec
24 changed files with 486 additions and 419 deletions
@@ -11,8 +11,8 @@ interface TournamentSettings {
type: string;
timestamp: string;
duration: number;
courts: any[];
teams: any[];
courts: { name?: string }[];
teams: { name?: string }[];
}
interface TournamentFormProps {
@@ -106,12 +106,13 @@ export default function TournamentForm({ tournamentId, onSuccess, onDelete }: To
await api.post('/tournaments', fullPayload);
}
onSuccess();
} catch (err: any) {
} catch (err: unknown) {
console.error(err);
if (Array.isArray(err.detail)) {
setError(err.detail.map((e: any) => `${e.loc.join('.')}: ${e.msg}`).join(', '));
const error = err as { detail?: string | Array<{ loc: string[]; msg: string }> };
if (Array.isArray(error.detail)) {
setError(error.detail.map((e) => `${e.loc.join('.')}: ${e.msg}`).join(', '));
} else {
setError(typeof err.detail === 'string' ? err.detail : "Error saving tournament");
setError(typeof error.detail === 'string' ? error.detail : "Error saving tournament");
}
} finally {
setIsSubmitting(false);