fix(frontend): fix array types to match api

This commit is contained in:
hanabi 2022-11-20 21:40:53 -05:00
parent 212d69b7ac
commit 52eed5ea56
2 changed files with 8 additions and 8 deletions

View File

@ -10,9 +10,9 @@ export type PartialMember = PartialPerson;
interface _Person extends PartialPerson {
bio: string | null;
links: string[] | null;
names: Name[];
pronouns: Pronoun[];
fields: Field[];
names: Name[] | null;
pronouns: Pronoun[] | null;
fields: Field[] | null;
}
export interface Member extends _Person {
@ -20,7 +20,7 @@ export interface Member extends _Person {
}
export interface User extends _Person {
members: PartialMember[];
members: PartialMember[] | null;
}
export type Person = Member | User;

View File

@ -82,9 +82,9 @@ function PersonPage({ person }: { person: Person }) {
<PersonAvatar person={person} />
<PersonInfo person={person} />
</div>
<LabelList content={person.names} />
<LabelList content={person.pronouns} />
<FieldCardGrid fields={person.fields} />
<LabelList content={person.names ?? []} />
<LabelList content={person.pronouns ?? []} />
<FieldCardGrid fields={person.fields ?? []} />
{ 'user' in person && (
<MemberList user={person as any as User} />
)}
@ -218,7 +218,7 @@ function MemberList({
<div className={`mx-auto flex-col items-center ${className || ""}`}>
<h1 className="text-2xl">Members</h1>
<ul>
{partialMembers.map((partialMember) => (
{partialMembers?.map((partialMember) => (
<li className='before:[content:"-_"]' key={partialMember.id}>
<BlueLink to={`/u/${user.name}/${partialMember.name}`}>
<span>{partialMember.display_name ?? partialMember.name}</span>