Skip to content

add check on event creation#67

Open
dylan-pham wants to merge 1 commit intomasterfrom
66-add-error-message-on-event-creation-attempt-with-missing-details
Open

add check on event creation#67
dylan-pham wants to merge 1 commit intomasterfrom
66-add-error-message-on-event-creation-attempt-with-missing-details

Conversation

@dylan-pham
Copy link
Copy Markdown

@dylan-pham dylan-pham commented Apr 16, 2023

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.

  • Approved by designer

Screenshots/Video

Include screenshots of added features/bugfixes if neccesary.
Screenshot 2023-04-16 at 4 44 55 PM

@dylan-pham dylan-pham linked an issue Apr 16, 2023 that may be closed by this pull request
@SimChadha SimChadha requested a review from ross3102 April 19, 2023 23:45
const eventDataCopy = { ...fields };

if (!hasAllEventDetails(eventDataCopy)) {
alert('missing required event details');
Copy link
Copy Markdown

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)

const schema = data['eventSchemas'][route.params.type.toLowerCase()];

function hasAllEventDetails(eventData: any) {
return (
Copy link
Copy Markdown

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?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

add error message on event creation attempt with missing details

3 participants