From 3a640e4bcd30633bf0724f4384f25a327c3cbf7a Mon Sep 17 00:00:00 2001 From: hanabi Date: Sun, 20 Nov 2022 21:57:30 -0500 Subject: [PATCH] fix(frontend): remove redundant member list fetch --- frontend/pages/u/[user]/index.tsx | 16 +++------------- 1 file changed, 3 insertions(+), 13 deletions(-) diff --git a/frontend/pages/u/[user]/index.tsx b/frontend/pages/u/[user]/index.tsx index 15f4901..4cce9e7 100644 --- a/frontend/pages/u/[user]/index.tsx +++ b/frontend/pages/u/[user]/index.tsx @@ -8,25 +8,15 @@ interface Props { partialMembers: PartialMember[]; } -export default function Index({ user, partialMembers }: Props) { +export default function Index({ user }: Props) { return ; } export const getServerSideProps: GetServerSideProps = async (context) => { const name = context.params!.user; try { - const [userResponse, partialMembersResponse] = await Promise.allSettled([ - fetchAPI(`/users/${name}`), - fetchAPI(`/users/${name}/members`), - ]); - if (userResponse.status === "rejected") - throw new Error("Could not fetch user"); - const user = userResponse.value; - const partialMembers = - partialMembersResponse.status === "fulfilled" - ? partialMembersResponse.value - : []; - return { props: { user, partialMembers } }; + const user = await fetchAPI(`/users/${name}`); + return { props: { user } }; } catch (e) { console.log(e); return { notFound: true };