From 26c29371a779064ae33e44cb74ea6f09e7d1b70f Mon Sep 17 00:00:00 2001 From: Arend Peter Date: Fri, 12 Jan 2024 14:00:06 -0800 Subject: [PATCH] Clean up syntax --- frontend/src/components/Elections/ElectionInvitations.tsx | 2 +- frontend/src/components/Elections/ElectionsYouManage.tsx | 2 +- frontend/src/components/Elections/ElectionsYouVotedIn.tsx | 2 +- frontend/src/components/Elections/OpenElections.tsx | 2 +- 4 files changed, 4 insertions(+), 4 deletions(-) diff --git a/frontend/src/components/Elections/ElectionInvitations.tsx b/frontend/src/components/Elections/ElectionInvitations.tsx index f32f3938..9f92efce 100644 --- a/frontend/src/components/Elections/ElectionInvitations.tsx +++ b/frontend/src/components/Elections/ElectionInvitations.tsx @@ -9,7 +9,7 @@ export default () => { useEffect(() => {fetchElections()}, []); const electionInvitations = React.useMemo( - () => data && data.elections_as_voter ? data.elections_as_voter : [], + () => data?.elections_as_voter ? data.elections_as_voter : [], [data], ); diff --git a/frontend/src/components/Elections/ElectionsYouManage.tsx b/frontend/src/components/Elections/ElectionsYouManage.tsx index 4a034135..ea1b43da 100644 --- a/frontend/src/components/Elections/ElectionsYouManage.tsx +++ b/frontend/src/components/Elections/ElectionsYouManage.tsx @@ -33,7 +33,7 @@ export default () => { } let managedElectionsData = useMemo(() => { - if(data && data.elections_as_official){ + if(data?.elections_as_official){ return data.elections_as_official.map(election => ({ ...election, roles: getRoles(election) diff --git a/frontend/src/components/Elections/ElectionsYouVotedIn.tsx b/frontend/src/components/Elections/ElectionsYouVotedIn.tsx index c5590122..ad7f8f11 100644 --- a/frontend/src/components/Elections/ElectionsYouVotedIn.tsx +++ b/frontend/src/components/Elections/ElectionsYouVotedIn.tsx @@ -10,7 +10,7 @@ export default () => { useEffect(() => {fetchElections()}, []); const electionInvitations = React.useMemo( - () => data && data.elections_as_voter ? data.elections_as_voter : [], + () => data?.elections_as_voter ? data.elections_as_voter : [], [data], ); diff --git a/frontend/src/components/Elections/OpenElections.tsx b/frontend/src/components/Elections/OpenElections.tsx index 9ad276ca..041898a7 100644 --- a/frontend/src/components/Elections/OpenElections.tsx +++ b/frontend/src/components/Elections/OpenElections.tsx @@ -9,7 +9,7 @@ export default () => { useEffect(() => {fetchElections()}, []); let openElectionsData = useMemo( - () => data && data.open_elections ? [...data.open_elections] : [], + () => data?.open_elections ? [...data.open_elections] : [], [data] );