Open
Conversation
SimChadha
approved these changes
Apr 19, 2023
ross3102
requested changes
Apr 21, 2023
| const eventDataCopy = { ...fields }; | ||
|
|
||
| if (!hasAllEventDetails(eventDataCopy)) { | ||
| alert('missing required event details'); |
There was a problem hiding this comment.
We should use the Toast component for all error messages, just replace alert with something like
Toast.show('Missing required event details', {
duration: Toast.durations.LONG,
backgroundColor: 'red',
position: 20,
});
(plus the import ofc)
| const schema = data['eventSchemas'][route.params.type.toLowerCase()]; | ||
|
|
||
| function hasAllEventDetails(eventData: any) { | ||
| return ( |
There was a problem hiding this comment.
I don't think this works quite right since different event types have different fields. For example, Special Events don't have a distance field, so with this logic it's impossible to create one. There's probably some way to check all of the fields specific to the event type?
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Description
Add check on event creation to make sure all details are filled out. Before, user would be able to create event with missing fields which resulted in null related bug when accessing event after creation.
Figma Designs
Include a link to the Figma design here if neccesary.
Screenshots/Video
Include screenshots of added features/bugfixes if neccesary.
