Merge pull request #170 from emrysal/bugfix/crash-when-username-does-not-exist-#144

Check if user exists or return a 404 before proceeding
pull/175/head
Bailey Pumfleet 2021-05-07 20:40:42 +01:00 committed by GitHub
commit 99ddb8a054
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 6 additions and 0 deletions

View File

@ -356,6 +356,12 @@ export async function getServerSideProps(context) {
}
});
if (!user) {
return {
notFound: true,
}
}
const eventType = await prisma.eventType.findFirst({
where: {
userId: user.id,