From 50322300eecbd2f155ce524d7c10d6e313c7d234 Mon Sep 17 00:00:00 2001 From: Craig Kaiser Date: Wed, 24 Jan 2024 14:01:48 -0500 Subject: [PATCH] convert number from settings input --- src/lib/components/tournament/Match.svelte | 1 + src/lib/components/tournament/Settings.svelte | 13 ++++++++++--- 2 files changed, 11 insertions(+), 3 deletions(-) diff --git a/src/lib/components/tournament/Match.svelte b/src/lib/components/tournament/Match.svelte index f12c46a..a5fd742 100644 --- a/src/lib/components/tournament/Match.svelte +++ b/src/lib/components/tournament/Match.svelte @@ -18,6 +18,7 @@ match = await matches.update(match); success(`Match ${match.matches_team1_fkey.name} vs ${match.matches_team2_fkey.name} updated`); } catch (err: any) { + console.error(err); error(err?.body?.message ?? `Something went wrong: ${err}`); } } diff --git a/src/lib/components/tournament/Settings.svelte b/src/lib/components/tournament/Settings.svelte index 9061b24..9876eac 100644 --- a/src/lib/components/tournament/Settings.svelte +++ b/src/lib/components/tournament/Settings.svelte @@ -12,6 +12,9 @@ export let event_id: number | string; async function createNewEvent(): Promise { + tournament.courts = Number(tournament.courts); + tournament.pools = Number(tournament.pools); + tournament .create(tournament) .then(async () => { @@ -30,15 +33,19 @@ } async function updateTournament(): Promise { + tournament.courts = Number(tournament.courts); + tournament.pools = Number(tournament.pools); + tournament .update(tournament.id, tournament) .then((res: Event) => { tournament = res; success(`Tournament settings updated`); }) - .catch((err: { body: { message: string | SvelteToastOptions } }) => - error(err?.body?.message) - ); + .catch((err) => { + console.error(err); + error(err.body?.message ?? `Something went wrong: ${err}`); + }); } async function deleteEvent(): Promise {