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 ({