From 4b35a526b455bd1796a6e33303229be675a3903a Mon Sep 17 00:00:00 2001 From: Brandon Presley Date: Sun, 4 Sep 2022 17:33:05 +1200 Subject: [PATCH] Fix error on editing plan --- EditPlan.tsx | 5 ++++- set.service.ts | 3 ++- 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/EditPlan.tsx b/EditPlan.tsx index 15e31cd..09aabd0 100644 --- a/EditPlan.tsx +++ b/EditPlan.tsx @@ -37,7 +37,10 @@ export default function EditPlan() { ); useEffect(() => { - getNames().then(setNames); + getNames().then(n => { + console.log(EditPlan.name, {n}); + setNames(n); + }); }, []); const save = useCallback(async () => { diff --git a/set.service.ts b/set.service.ts index 713f61f..1a8dfc9 100644 --- a/set.service.ts +++ b/set.service.ts @@ -102,7 +102,8 @@ export const setSetImage = async (name: string, image: string) => { export const getNames = async (): Promise => { const [result] = await db.executeSql('SELECT DISTINCT name FROM sets'); - return result.rows.raw(); + const values: {name: string}[] = result.rows.raw(); + return values.map(value => value.name); }; export const getWorkouts = async ({