kahikatea-2022 / Time-Exchange

0 stars 1 forks source link

Check if username and email are unique #26

Open MarvinTheParanoid opened 2 years ago

MarvinTheParanoid commented 2 years ago

The DB will only accept unique usernames and emails (it will throw an error if they're not unique). We need some way to give the user feedback if the entered email and/or username is taken already.

We wouldn't want to have all usernames and emails stored in the browser for security and efficiency reasons, so we might need new api end points to check if the username/email is already taken.

Here is the Formik documentation on validation, and a related Stack overflow thread.

MarvinTheParanoid commented 2 years ago

IDK if email need to be unique as it's been handled by Auth0. API to check username has been created tho. Just needs to be implemented on the front end.

MarvinTheParanoid commented 2 years ago

No longer using Formik.

One way to do do this would be to keep and error state. On submit (or on username field blur/change) make the request set the error state with a message saying username is not unique. We could then have a some text that shows the error state if there is one set.