Basic validation for New Event Type to prevent unexpected behaviour
Previously, when creating a new event type, user was still allowed to create a new event type, even if the event length's field was empty. This would cause a prisma error, since it would receive NaN and no event would have been added, but the page still reloaded. Therefore, a very basic validation to address this, at least in the short-term.
This commit is contained in:
		
							parent
							
								
									64d3fcfab2
								
							
						
					
					
						commit
						c09ce2b2b5
					
				
					 1 changed files with 4 additions and 2 deletions
				
			
		|  | @ -61,8 +61,9 @@ export default function Availability(props) { | |||
|             } | ||||
|         }); | ||||
| 
 | ||||
|         console.log(response); | ||||
|         Router.reload(); | ||||
|         if (enteredTitle && enteredLength) { | ||||
|             Router.reload(); | ||||
|         } | ||||
|     } | ||||
| 
 | ||||
|     async function updateStartEndTimesHandler(event) { | ||||
|  | @ -217,6 +218,7 @@ export default function Availability(props) { | |||
|                                             </div> | ||||
|                                         </div> | ||||
|                                     </div> | ||||
|                                     {/* TODO: Add an error message when required input fields empty*/} | ||||
|                                     <div className="mt-5 sm:mt-4 sm:flex sm:flex-row-reverse"> | ||||
|                                         <button type="submit" className="btn btn-primary"> | ||||
|                                             Create | ||||
|  |  | |||
		Loading…
	
		Reference in a new issue
	
	 Damian Harateh
						Damian Harateh