diff --git a/src/pages/Register/index.tsx b/src/pages/Register/index.tsx index d5f3785..20ef688 100644 --- a/src/pages/Register/index.tsx +++ b/src/pages/Register/index.tsx @@ -107,16 +107,20 @@ const RegistrationForm = () => { navigate('/register/confirm') }, onError: err => { - // TODO: if status is 409, tell user that email/username is already registered - // FIX: error.message does not work? - setError(err.message || 'Registration failed. Please try again.') + if (err.status === 409) { + setError('This email or username is already registered.') + } else if (err.status === 400) { + setError('Invalid input. Please try again.') + } else { + setError('Registration failed. Please try again.') + } } } ) const handleSubmit = (e: React.FormEvent) => { - registerUser() e.preventDefault() + registerUser() } return (