Skip to content

Commit

Permalink
fix(profile): filter out empty pronouns from response
Browse files Browse the repository at this point in the history
  • Loading branch information
seth2810 committed Oct 20, 2024
1 parent 9d75c60 commit ab4fe02
Showing 1 changed file with 7 additions and 5 deletions.
12 changes: 7 additions & 5 deletions src/pages/settings/profile.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -497,12 +497,14 @@ type Props = SSRProps<{
}>;

export const getServerSideProps: GetServerSideProps<Props> = async (ctx) => {
// eslint-disable-next-line react-hooks/rules-of-hooks
const res = await fetch('https://api.stats.fm/api/v1/me/available-pronouns')
.then((res) => res.json())
.then((res) => res.items);
const pronouns = Object.values(res).flat() as Pronoun[];
const user = await fetchUser(ctx);
const pronounsResponse = await fetch(
'https://api.stats.fm/api/v1/me/available-pronouns',
);
const { items: pronounsItems } = await pronounsResponse.json();
const pronouns = Object.values<Pronoun>(pronounsItems).filter(
({ aliases }) => aliases.length !== 0,
);

return {
props: {
Expand Down

0 comments on commit ab4fe02

Please sign in to comment.