Skip to content

Commit

Permalink
Don't crash webapp when displaying resigned members in election stats.
Browse files Browse the repository at this point in the history
  • Loading branch information
brandonfancher committed Apr 11, 2022
1 parent 39f1809 commit 90bf6c5
Showing 1 changed file with 10 additions and 5 deletions.
15 changes: 10 additions & 5 deletions packages/webapp/src/members/helpers/formatters.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,14 +10,19 @@ export const formatMembersQueryNodeAsMemberNFT = (
data: MembersQueryNode
): MemberNFT | undefined => {
if (!data) return;

if (!data.profile) {
console.info(`${data.account} has since resigned`);
}

return {
createdAt: data.createdAt ? new Date(data.createdAt).getTime() : 0,
account: data.account,
name: data.profile.name,
image: data.profile.img,
attributions: data.profile.attributions,
bio: data.profile.bio,
socialHandles: JSON.parse(data.profile.social),
name: data.profile?.name ?? data.account,
image: data.profile?.img,
attributions: data.profile?.attributions,
bio: data.profile?.bio,
socialHandles: data.profile ? JSON.parse(data.profile.social) : {},
inductionVideo: data.inductionVideo,
};
};
Expand Down

0 comments on commit 90bf6c5

Please sign in to comment.