hunterwilkins2 / bulldog-books

An online bookstore for UGA CSCI 4050. Created with React and Node.
MIT License
2 stars 3 forks source link

Verifying all info for address and payment when some of the fields are field in #26

Closed hunterwilkins2 closed 3 years ago

hunterwilkins2 commented 3 years ago

I'm not sure how easy it will be to implement, but if a user fills out one of the fields in address or payment, the form should require that all the other fields are filled out. Otherwise, if none of the fields is field out then the user should be able to register.

GaryBarnes13 commented 3 years ago

Going to look into this right now. May be a bit more complex

GaryBarnes13 commented 3 years ago

I think I have this feature working for the card fields. The problem is, I can't seem to get Yup to throw an error when a field is empty unless the field is required (which the card stuff is not), so I have a hard time hooking this into the validation schema that I use to prevent submission. Meaning, if someone enters all their mandatory info and one piece of their card info, all the other card fields will be highlighted as invalid until the correct stuff is in them, but the user could still go ahead and submit with partial information.

hunterwilkins2 commented 3 years ago

Could you create a separate validation schema for address and payment, then submit when none of the optional fields are filled in, or just throw an error when the user tries to submit but doesn't have each field filled out? I quickly looked over the formik docs and it seems like it might be possible if you just manually add an if statement to see if setValues is true. I haven't worked with formik before so you would know if this would actually be possible.

GaryBarnes13 commented 3 years ago

Yea I could look into that. Is this something you want me to prioritize, or something I should save for the future?

hunterwilkins2 commented 3 years ago

It's probably something you can save for the future. What are you going to work on next?

GaryBarnes13 commented 3 years ago

Working on the edit profile page for sure. Any other suggestions/more pressing work?

hunterwilkins2 commented 3 years ago

Ok, sounds good. I implemented the auth today so we can go ahead and hook up the register and login. It would be nice if we could refactor the front end to combine admin and customers for this deliverable.

GaryBarnes13 commented 3 years ago

Got it working. Would be nice if someone would test it since there's a decent chance I missed something