Skip to content

Commit

Permalink
Use discordId as key
Browse files Browse the repository at this point in the history
  • Loading branch information
MikuroXina committed Oct 2, 2023
1 parent 4828e4b commit 23153d6
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 2 deletions.
7 changes: 6 additions & 1 deletion src/lib/member-fetch.ts
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@ function validateSNSLinks(links: unknown): links is readonly SNSLinkInfo[] {

export type Member = {
username: string;
discordId: string;
associatedLinks: readonly SNSLinkInfo[];
};

Expand All @@ -37,7 +38,11 @@ function validateMember(obj: unknown): obj is Member {
}

if (typeof (obj as Member).username !== "string") {
console.error("`avatar` not in: ", obj);
console.error("`username` not in: ", obj);
return false;
}
if (typeof (obj as Member).discordId !== "string") {
console.error("`discordId` not in: ", obj);
return false;
}
if (!validateSNSLinks((obj as Member).associatedLinks)) {
Expand Down
2 changes: 1 addition & 1 deletion src/pages/member.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ const MembersPage: NextPage<MembersPageProps> = ({ members }) => {
<Title>メンバー紹介</Title>
<Grid gap={2} templateColumns="repeat(auto-fill, minmax(15em, 1fr))">
{members.map((member) => (
<GridItem key={member.username} borderRadius="3xl" bgColor={cardBg}>
<GridItem key={member.discordId} borderRadius="3xl" bgColor={cardBg}>
<MemberCard {...member} />
</GridItem>
))}
Expand Down

0 comments on commit 23153d6

Please sign in to comment.