This commit is contained in:
Marshall Polaris 2022-08-12 20:38:59 -07:00
parent 45ffd5a1cc
commit f4c90e9f6b

View File

@ -15,9 +15,10 @@ import { authenticateOnServer } from 'web/lib/firebase/server-auth'
export const getServerSideProps: GetServerSideProps = async (ctx) => {
const creds = await authenticateOnServer(ctx)
const username = ctx.params!.username as string // eslint-disable-line @typescript-eslint/no-non-null-assertion
const [auth, user] = (await Promise.all([
creds != null ? getUserAndPrivateUser(creds.user.uid) : null,
getUserByUsername(ctx.params!.username as string), // eslint-disable-line @typescript-eslint/no-non-null-assertion
getUserByUsername(username),
])) as [UserAndPrivateUser | null, User | null]
return { props: { auth, user } }
}