From 52a4eada946cd75f858d3e23d0398bafd7f43f83 Mon Sep 17 00:00:00 2001 From: Brandon Presley Date: Sun, 10 Jul 2022 16:10:06 +1200 Subject: [PATCH] Fix adding plan --- EditPlan.tsx | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/EditPlan.tsx b/EditPlan.tsx index fa57ba1..e6400e5 100644 --- a/EditPlan.tsx +++ b/EditPlan.tsx @@ -34,10 +34,11 @@ export default function EditPlan({ }, [plan, db]); const save = useCallback(async () => { + console.log(`${EditPlan.name}.save`, {days, workouts, plan}); if (!days || !workouts) return; const newWorkouts = workouts.filter(workout => workout).join(','); const newDays = days.filter(day => day).join(','); - if (!plan) + if (!plan?.id) await db.executeSql(`INSERT INTO plans(days, workouts) VALUES (?, ?)`, [ newDays, newWorkouts,