Next.js Discord

Discord Forum

checking email and username availability

Unanswered
astro posted this in #help-forum
Open in Discord
in my prisma schema i've marked username and email field unique, however using zod validation doesnt help in validating whether the username is already taken and when a post req is made to the api call the database just throws an error. thus how do i check whether the username is already taken or available for use
P.S. im using zod and react-hook-forms in my stack

2 Replies

will using auth libraries like nextauth.js and stuff help resolve this issue with ease
American Crow
Don't know if i understand this correctly but Zod does support async validation.
Sounds related to this one: https://github.com/orgs/react-hook-form/discussions/10545