Skip to content

Commit

Permalink
check id for getting platformId
Browse files Browse the repository at this point in the history
  • Loading branch information
zuies committed Dec 3, 2023
1 parent 1f1293c commit b874629
Show file tree
Hide file tree
Showing 8 changed files with 9 additions and 9 deletions.
2 changes: 1 addition & 1 deletion src/components/pages/pageIndex/ActiveMemberComposition.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down
4 changes: 2 additions & 2 deletions src/components/pages/pageIndex/HeatmapChart.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down Expand Up @@ -152,7 +152,7 @@ const HeatmapChart = () => {
const community =
StorageService.readLocalStorage<IDiscordModifiedCommunity>('community');

const platformId = community?.platforms[0].id;
const platformId = community?.platforms[0]?.id;

if (platformId) {
const data = await retrievePlatformById(platformId);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down
2 changes: 1 addition & 1 deletion src/pages/community-health.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ function CommunityHealth() {
useState<IFragmentationScoreResponse | null>(null);

useEffect(() => {
const platformId = community?.platforms[0].id;
const platformId = community?.platforms[0]?.id;

if (platformId) {
Promise.all([
Expand Down
2 changes: 1 addition & 1 deletion src/pages/membersInteraction.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -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[]) => {
Expand Down
2 changes: 1 addition & 1 deletion src/pages/statistics.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -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<boolean>(true);
const [activeMemberDate, setActiveMemberDate] = useState(1);
Expand Down

0 comments on commit b874629

Please sign in to comment.