From e0a19bdd434f51e393ea576a42d2ce9846965ce8 Mon Sep 17 00:00:00 2001 From: Sammy Teillet Date: Thu, 20 Apr 2023 16:59:03 +0200 Subject: [PATCH] refactor: rename and remove default data --- front/src/pages/people/People.tsx | 10 ++++------ 1 file changed, 4 insertions(+), 6 deletions(-) diff --git a/front/src/pages/people/People.tsx b/front/src/pages/people/People.tsx index c99637949..94b96018a 100644 --- a/front/src/pages/people/People.tsx +++ b/front/src/pages/people/People.tsx @@ -45,7 +45,7 @@ const defaultOrderBy = [ }, ]; -const reduceSortsToGqlSorts = (sorts: Array): OrderBy[] => { +const reduceSortsToOrderBy = (sorts: Array): OrderBy[] => { const mappedSorts = sorts.reduce((acc, sort) => { acc[sort.id] = sort.order; return acc; @@ -55,19 +55,17 @@ const reduceSortsToGqlSorts = (sorts: Array): OrderBy[] => { function People() { const [sorts, setSorts] = useState([] as Array); - const orderBy = sorts.length ? reduceSortsToGqlSorts(sorts) : defaultOrderBy; + const orderBy = sorts.length ? reduceSortsToOrderBy(sorts) : defaultOrderBy; const { data } = useQuery<{ person: GraphqlPerson[] }>(GET_PEOPLE, { variables: { orderBy: orderBy }, }); - const mydata: Person[] = data ? data.person.map(mapPerson) : defaultData; - return ( - {mydata && ( + {data && (