Return 404 when requesting event url that does not exist
This commit is contained in:
		
							parent
							
								
									aed5af0f5e
								
							
						
					
					
						commit
						cc1b3fa7dd
					
				
					 1 changed files with 40 additions and 38 deletions
				
			
		|  | @ -389,12 +389,7 @@ export async function getServerSideProps(context) { | ||||||
|     } |     } | ||||||
|   }); |   }); | ||||||
| 
 | 
 | ||||||
|     if (!user) { |   if (user) { | ||||||
|         return { |  | ||||||
|             notFound: true, |  | ||||||
|         } |  | ||||||
|     } |  | ||||||
| 
 |  | ||||||
|     const eventType = await prisma.eventType.findFirst({ |     const eventType = await prisma.eventType.findFirst({ | ||||||
|       where: { |       where: { | ||||||
|         userId: user.id, |         userId: user.id, | ||||||
|  | @ -409,6 +404,13 @@ export async function getServerSideProps(context) { | ||||||
|         length: true |         length: true | ||||||
|       } |       } | ||||||
|     }); |     }); | ||||||
|  |   } | ||||||
|  | 
 | ||||||
|  |   if (!user || !eventType) { | ||||||
|  |     return { | ||||||
|  |       notFound: true, | ||||||
|  |     } | ||||||
|  |   } | ||||||
| 
 | 
 | ||||||
|   return { |   return { | ||||||
|     props: { |     props: { | ||||||
|  |  | ||||||
		Loading…
	
		Reference in a new issue
	
	 Alex van Andel
						Alex van Andel