-
Notifications
You must be signed in to change notification settings - Fork 0
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
add check on event creation #67
base: master
Are you sure you want to change the base?
add check on event creation #67
Conversation
const createEvent = () => { | ||
const eventDataCopy = { ...fields }; | ||
|
||
if (!hasAllEventDetails(eventDataCopy)) { | ||
alert('missing required event details'); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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)
@@ -86,8 +86,27 @@ const CreateEvent = ({ navigation, route }: CreateEventProps) => { | |||
|
|||
const schema = data['eventSchemas'][route.params.type.toLowerCase()]; | |||
|
|||
function hasAllEventDetails(eventData: any) { | |||
return ( |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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?
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.
