From b874629e5ea553e76db5c4f289e175a101f4b60f Mon Sep 17 00:00:00 2001 From: zuies Date: Mon, 4 Dec 2023 00:16:23 +0300 Subject: [PATCH] check id for getting platformId --- src/components/pages/pageIndex/ActiveMemberComposition.tsx | 2 +- src/components/pages/pageIndex/HeatmapChart.tsx | 4 ++-- .../memberBreakdowns/activeMembers/ActiveMemberBreakdown.tsx | 2 +- .../DisengagedMembersCompositionBreakdown.tsx | 2 +- .../onboardingMembers/OnboardingMembersBreakdown.tsx | 2 +- src/pages/community-health.tsx | 2 +- src/pages/membersInteraction.tsx | 2 +- src/pages/statistics.tsx | 2 +- 8 files changed, 9 insertions(+), 9 deletions(-) diff --git a/src/components/pages/pageIndex/ActiveMemberComposition.tsx b/src/components/pages/pageIndex/ActiveMemberComposition.tsx index d93c3a1b..02fd7d64 100644 --- a/src/components/pages/pageIndex/ActiveMemberComposition.tsx +++ b/src/components/pages/pageIndex/ActiveMemberComposition.tsx @@ -18,7 +18,7 @@ const ActiveMemberComposition = () => { let endDate: moment.Moment = moment().subtract(1, 'day'); let startDate: moment.Moment = moment(endDate).subtract(7, 'days'); - const platformId = community?.platforms[0].id; + const platformId = community?.platforms[0]?.id; if (platformId) { fetchActiveMembers(platformId, startDate, endDate); diff --git a/src/components/pages/pageIndex/HeatmapChart.tsx b/src/components/pages/pageIndex/HeatmapChart.tsx index ae2fe1a2..a371f2e4 100644 --- a/src/components/pages/pageIndex/HeatmapChart.tsx +++ b/src/components/pages/pageIndex/HeatmapChart.tsx @@ -52,7 +52,7 @@ const HeatmapChart = () => { const { community } = useToken(); - const platformId = community?.platforms[0].id; + const platformId = community?.platforms[0]?.id; const fetchData = async () => { setLoading(true); @@ -152,7 +152,7 @@ const HeatmapChart = () => { const community = StorageService.readLocalStorage('community'); - const platformId = community?.platforms[0].id; + const platformId = community?.platforms[0]?.id; if (platformId) { const data = await retrievePlatformById(platformId); diff --git a/src/components/pages/statistics/memberBreakdowns/activeMembers/ActiveMemberBreakdown.tsx b/src/components/pages/statistics/memberBreakdowns/activeMembers/ActiveMemberBreakdown.tsx index 782d7033..994a69c0 100644 --- a/src/components/pages/statistics/memberBreakdowns/activeMembers/ActiveMemberBreakdown.tsx +++ b/src/components/pages/statistics/memberBreakdowns/activeMembers/ActiveMemberBreakdown.tsx @@ -59,7 +59,7 @@ export default function ActiveMemberBreakdown() { totalResults: 0, totalPages: 0, }); - const platformId = community?.platforms[0].id; + const platformId = community?.platforms[0]?.id; const handlePageChange = (selectedPage: number) => { setPage(selectedPage); diff --git a/src/components/pages/statistics/memberBreakdowns/disengagedMembersComposition/DisengagedMembersCompositionBreakdown.tsx b/src/components/pages/statistics/memberBreakdowns/disengagedMembersComposition/DisengagedMembersCompositionBreakdown.tsx index 793185bb..d750d6be 100644 --- a/src/components/pages/statistics/memberBreakdowns/disengagedMembersComposition/DisengagedMembersCompositionBreakdown.tsx +++ b/src/components/pages/statistics/memberBreakdowns/disengagedMembersComposition/DisengagedMembersCompositionBreakdown.tsx @@ -71,7 +71,7 @@ export default function DisengagedMembersCompositionBreakdown() { totalPages: 0, }); - const platformId = community?.platforms[0].id; + const platformId = community?.platforms[0]?.id; const handlePageChange = (selectedPage: number) => { setPage(selectedPage); diff --git a/src/components/pages/statistics/memberBreakdowns/onboardingMembers/OnboardingMembersBreakdown.tsx b/src/components/pages/statistics/memberBreakdowns/onboardingMembers/OnboardingMembersBreakdown.tsx index b4ac8941..ef0974eb 100644 --- a/src/components/pages/statistics/memberBreakdowns/onboardingMembers/OnboardingMembersBreakdown.tsx +++ b/src/components/pages/statistics/memberBreakdowns/onboardingMembers/OnboardingMembersBreakdown.tsx @@ -59,7 +59,7 @@ export default function OnboardingMembersBreakdown() { totalPages: 0, }); - const platformId = community?.platforms[0].id; + const platformId = community?.platforms[0]?.id; const handlePageChange = (selectedPage: number) => { setPage(selectedPage); diff --git a/src/pages/community-health.tsx b/src/pages/community-health.tsx index fcb4b062..6cc408ac 100644 --- a/src/pages/community-health.tsx +++ b/src/pages/community-health.tsx @@ -21,7 +21,7 @@ function CommunityHealth() { useState(null); useEffect(() => { - const platformId = community?.platforms[0].id; + const platformId = community?.platforms[0]?.id; if (platformId) { Promise.all([ diff --git a/src/pages/membersInteraction.tsx b/src/pages/membersInteraction.tsx index 74a8c74f..335b7c3a 100644 --- a/src/pages/membersInteraction.tsx +++ b/src/pages/membersInteraction.tsx @@ -102,7 +102,7 @@ export default function membersInteraction() { const { getMemberInteraction, isLoading } = useAppStore(); useEffect(() => { - const platformId = community?.platforms[0].id; + const platformId = community?.platforms[0]?.id; if (platformId) { getMemberInteraction(platformId).then((apiResponse: any[]) => { diff --git a/src/pages/statistics.tsx b/src/pages/statistics.tsx index 9e9b6b07..7abcd6a5 100644 --- a/src/pages/statistics.tsx +++ b/src/pages/statistics.tsx @@ -22,7 +22,7 @@ import Image from 'next/image'; const Statistics = () => { const { community } = useToken(); - const platformId = community?.platforms[0].id; + const platformId = community?.platforms[0]?.id; const [loading, setLoading] = useState(true); const [activeMemberDate, setActiveMemberDate] = useState(1);